Projects
Mega:24.03:SP1:Everything
openjdk-1.8.0
_service:tar_scm:The-code-style-is-fixed-and-te...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:The-code-style-is-fixed-and-test-cases-are-added.patch of Package openjdk-1.8.0
From 0a877e963eeb55b98dcd0194ac44b4f010d382eb Mon Sep 17 00:00:00 2001 Date: Wed, 21 Sep 2022 09:54:56 +0800 Subject: The code style is fixed and test cases are added --- hotspot/src/share/vm/cds/archiveBuilder.hpp | 1 - hotspot/src/share/vm/cds/archiveUtils.hpp | 1 - hotspot/src/share/vm/cds/dynamicArchive.hpp | 1 - .../share/vm/classfile/systemDictionary.cpp | 2 +- .../vm/classfile/systemDictionaryShared.hpp | 1 + .../shared/parGCAllocBuffer.cpp | 6 +- hotspot/src/share/vm/memory/filemap.cpp | 7 +- hotspot/src/share/vm/memory/filemap.hpp | 2 +- .../src/share/vm/memory/metaspaceClosure.cpp | 25 + .../src/share/vm/memory/metaspaceClosure.hpp | 25 +- hotspot/src/share/vm/oops/cpCache.cpp | 1 - hotspot/src/share/vm/oops/instanceKlass.cpp | 4 - hotspot/test/runtime/6929067/Test6929067.sh | 2 +- hotspot/test/runtime/Thread/StopAtExit.java | 119 ++++ jdk/make/profile-rtjar-includes.txt | 7 +- .../classes/java/io/ObjectInputStream.java | 4 +- .../classes/java/io/ObjectOutputStream.java | 10 +- .../classes/sun/awt/FontConfiguration.java | 7 +- .../security/openssl/kae_cipher_rsa.c | 3 +- .../security/openssl/kae_keyagreement_dh.c | 4 +- .../openssl/RSAKeyPairGeneratorBenchmark.java | 2 +- 22 files changed, 194 insertions(+), 668 deletions(-) create mode 100644 hotspot/test/runtime/Thread/StopAtExit.java diff --git a/hotspot/src/share/vm/cds/archiveBuilder.hpp b/hotspot/src/share/vm/cds/archiveBuilder.hpp index f7a5c107..93c0e245 100644 --- a/hotspot/src/share/vm/cds/archiveBuilder.hpp +++ b/hotspot/src/share/vm/cds/archiveBuilder.hpp @@ -29,7 +29,6 @@ #include "cds/archiveUtils.hpp" #include "cds/dumpAllocStats.hpp" #include "memory/metaspaceClosure.hpp" -//#include "oops/array.hpp" #include "oops/klass.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" diff --git a/hotspot/src/share/vm/cds/archiveUtils.hpp b/hotspot/src/share/vm/cds/archiveUtils.hpp index 55c2431a..44f03c8e 100644 --- a/hotspot/src/share/vm/cds/archiveUtils.hpp +++ b/hotspot/src/share/vm/cds/archiveUtils.hpp @@ -133,7 +133,6 @@ public: _dump_region->append_intptr_t((intptr_t)tag); } - //void do_oop(oop* o); void do_region(u_char* start, size_t size); bool reading() const { return false; } }; diff --git a/hotspot/src/share/vm/cds/dynamicArchive.hpp b/hotspot/src/share/vm/cds/dynamicArchive.hpp index 1d5b7122..0e068e65 100644 --- a/hotspot/src/share/vm/cds/dynamicArchive.hpp +++ b/hotspot/src/share/vm/cds/dynamicArchive.hpp @@ -26,7 +26,6 @@ #ifndef SHARE_VM_CDS_DYNAMICARCHIVE_HPP #define SHARE_VM_CDS_DYNAMICARCHIVE_HPP -//#include "classfile/compactHashtable.hpp" #include "memory/allocation.hpp" #include "memory/filemap.hpp" #include "memory/memRegion.hpp" diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 2eebdbac..0ea2d9b7 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1344,7 +1344,7 @@ instanceKlassHandle SystemDictionary::load_shared_class( Handle klass_name = java_lang_String::create_from_str(name, CHECK_0); JavaValue result(T_OBJECT); - // load_shared_class need protected domain to handle non-bootstrap loaded class, + // load_shared_class need protected domain to handle non-bootstrap loaded class, // so here call_virtual to call getProtectionDomainInternal function of URLClassLoader.java, // to get protected domain and save into result. JavaCalls::call_virtual(&result, diff --git a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp index 36423bee..fb9583d4 100644 --- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp @@ -194,6 +194,7 @@ public: } return true; } + static size_t estimate_size_for_archive(); static void write_to_archive(); static void write_dictionary(RunTimeSharedDictionary* dictionary, bool is_builtin); diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp index bddf14b6..0244bf84 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp @@ -98,9 +98,9 @@ void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) { if (_allocated == 0) { assert(_unused == 0, err_msg("Inconsistency in PLAB stats: " - "_allocated: "SIZE_FORMAT", " - "_wasted: "SIZE_FORMAT", " - "_unused: "SIZE_FORMAT", " + "_allocated: " SIZE_FORMAT ", " + "_wasted: " SIZE_FORMAT ", " + "_unused: " SIZE_FORMAT ", " "_used : "SIZE_FORMAT, _allocated, _wasted, _unused, _used)); diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp index 1891fc80..0682cd67 100644 --- a/hotspot/src/share/vm/memory/filemap.cpp +++ b/hotspot/src/share/vm/memory/filemap.cpp @@ -240,12 +240,7 @@ void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment _version = current_version(); _alignment = alignment; _obj_alignment = ObjectAlignmentInBytes; - /* TODO - _compressed_oops = UseCompressedOops; - _compressed_class_ptrs = UseCompressedClassPointers; - _max_heap_size = MaxHeapSize; - _narrow_klass_shift = CompressedKlassPointers::shift(); - */ + if (!DynamicDumpSharedSpaces) { _classpath_entry_table_size = mapinfo->_classpath_entry_table_size; _classpath_entry_table = mapinfo->_classpath_entry_table; diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp index 36b27f13..27fff35e 100644 --- a/hotspot/src/share/vm/memory/filemap.hpp +++ b/hotspot/src/share/vm/memory/filemap.hpp @@ -232,7 +232,7 @@ public: char* region_end(int i) { return region_base(i) + used_aligned(i); } struct FileMapHeader* header() { return _header; } struct DynamicArchiveHeader* dynamic_header() { - // assert(!is_static(), "must be"); + return (struct DynamicArchiveHeader*)header(); } diff --git a/hotspot/src/share/vm/memory/metaspaceClosure.cpp b/hotspot/src/share/vm/memory/metaspaceClosure.cpp index 00ec8fce..e19402cb 100644 --- a/hotspot/src/share/vm/memory/metaspaceClosure.cpp +++ b/hotspot/src/share/vm/memory/metaspaceClosure.cpp @@ -1,3 +1,28 @@ +/* + * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, Huawei Technologies Co., Ltd. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + #include "precompiled.hpp" #include "memory/metaspaceClosure.hpp" diff --git a/hotspot/src/share/vm/memory/metaspaceClosure.hpp b/hotspot/src/share/vm/memory/metaspaceClosure.hpp index f67d8d6f..5422e2a0 100644 --- a/hotspot/src/share/vm/memory/metaspaceClosure.hpp +++ b/hotspot/src/share/vm/memory/metaspaceClosure.hpp @@ -1,4 +1,27 @@ - +/* + * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, Huawei Technologies Co., Ltd. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ #ifndef SHARE_VM_MEMORY_METASPACECLOSURE_HPP #define SHARE_VM_MEMORY_METASPACECLOSURE_HPP diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index 51f5397b..874cef41 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -610,7 +610,6 @@ void ConstantPoolCache::metaspace_pointers_do(MetaspaceClosure* it) { dynamic_cds_log->print_cr("Iter(ConstantPoolCache): %p", this); } it->push(&_constant_pool); - // it->push(&_reference_map); } void ConstantPoolCache::remove_unshareable_info() { diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 9276b895..2a9cd92d 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -526,10 +526,6 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) { } } } - - // it->push(&_nest_members); - // it->push(&_permitted_subclasses); - // it->push(&_record_components); } klassVtable* InstanceKlass::vtable() const { diff --git a/hotspot/test/runtime/6929067/Test6929067.sh b/hotspot/test/runtime/6929067/Test6929067.sh index 438a287c..c78e1787 100644 --- a/hotspot/test/runtime/6929067/Test6929067.sh +++ b/hotspot/test/runtime/6929067/Test6929067.sh @@ -102,7 +102,7 @@ esac if [ "${VM_CPU}" == "aarch64" ]; then - COMP_FLAG="-mabi=lp64" + COMP_FLAG="" fi # VM type: need to know server or client diff --git a/hotspot/test/runtime/Thread/StopAtExit.java b/hotspot/test/runtime/Thread/StopAtExit.java new file mode 100644 index 00000000..8d6344a6 --- /dev/null +++ b/hotspot/test/runtime/Thread/StopAtExit.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8167108 + * @summary Stress test java.lang.Thread.stop() at thread exit. + * @run main/othervm StopAtExit + */ + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class StopAtExit extends Thread { + final static int N_THREADS = 32; + final static int N_LATE_CALLS = 1000; + + public CountDownLatch exitSyncObj = new CountDownLatch(1); + public CountDownLatch startSyncObj = new CountDownLatch(1); + + @Override + public void run() { + try { + // Tell main thread we have started. + startSyncObj.countDown(); + try { + // Wait for main thread to interrupt us so we + // can race to exit. + exitSyncObj.await(); + } catch (InterruptedException e) { + // ignore because we expect one + } + } catch (ThreadDeath td) { + // ignore because we're testing Thread.stop() which throws it + } catch (NoClassDefFoundError ncdfe) { + // ignore because we're testing Thread.stop() which can cause it + } + } + + public static void main(String[] args) { + StopAtExit threads[] = new StopAtExit[N_THREADS]; + + for (int i = 0; i < N_THREADS; i++ ) { + threads[i] = new StopAtExit(); + int late_count = 1; + threads[i].start(); + try { + // Wait for the worker thread to get going. + threads[i].startSyncObj.await(); + + // This interrupt() call will break the worker out + // of the exitSyncObj.await() call and the stop() + // calls will come in during thread exit. + threads[i].interrupt(); + for (; late_count <= N_LATE_CALLS; late_count++) { + threads[i].stop(); + + if (!threads[i].isAlive()) { + // Done with Thread.stop() calls since + // thread is not alive. + break; + } + } + } catch (InterruptedException e) { + throw new Error("Unexpected: " + e); + } catch (NoClassDefFoundError ncdfe) { + // Ignore because we're testing Thread.stop() which can + // cause it. Yes, a NoClassDefFoundError that happens + // in a worker thread can subsequently be seen in the + // main thread. + } + + System.out.println("INFO: thread #" + i + ": made " + late_count + + " late calls to java.lang.Thread.stop()"); + System.out.println("INFO: thread #" + i + ": N_LATE_CALLS==" + + N_LATE_CALLS + " value is " + + ((late_count >= N_LATE_CALLS) ? "NOT " : "") + + "large enough to cause a Thread.stop() " + + "call after thread exit."); + + try { + threads[i].join(); + } catch (InterruptedException e) { + throw new Error("Unexpected: " + e); + } + threads[i].stop(); + if (threads[i].isAlive()) { + throw new Error("Expected !Thread.isAlive() after thread #" + + i + " has been join()'ed"); + } + } + + String cmd = System.getProperty("sun.java.command"); + if (cmd != null && !cmd.startsWith("com.sun.javatest.regtest.agent.MainWrapper")) { + // Exit with success in a non-JavaTest environment: + System.exit(0); + } + } +} diff --git a/jdk/make/profile-rtjar-includes.txt b/jdk/make/profile-rtjar-includes.txt index f36d1d5c..dd275590 100644 --- a/jdk/make/profile-rtjar-includes.txt +++ b/jdk/make/profile-rtjar-includes.txt @@ -73,8 +73,8 @@ PROFILE_1_RTJAR_INCLUDE_PACKAGES := \ PROFILE_1_RTJAR_INCLUDE_TYPES := -PROFILE_1_RTJAR_EXCLUDE_TYPES := - +PROFILE_1_RTJAR_EXCLUDE_TYPES := \ + com/huawei PROFILE_1_INCLUDE_METAINF_SERVICES := @@ -99,7 +99,8 @@ PROFILE_2_RTJAR_INCLUDE_PACKAGES := \ PROFILE_2_RTJAR_INCLUDE_TYPES := -PROFILE_2_RTJAR_EXCLUDE_TYPES := +PROFILE_2_RTJAR_EXCLUDE_TYPES := \ + com/huawei PROFILE_2_INCLUDE_METAINF_SERVICES := \ META-INF/services/sun.util.spi.XmlPropertiesProvider diff --git a/jdk/src/share/classes/java/io/ObjectInputStream.java b/jdk/src/share/classes/java/io/ObjectInputStream.java index af6c5dd6..85e3958b 100644 --- a/jdk/src/share/classes/java/io/ObjectInputStream.java +++ b/jdk/src/share/classes/java/io/ObjectInputStream.java @@ -768,7 +768,7 @@ public class ObjectInputStream * Cache the class meta during serialization. * Only used in FastSerilizer. */ - protected static ConcurrentHashMap<String,Class<?>> nameToClass = new ConcurrentHashMap<>(); + private static ConcurrentHashMap<String,Class<?>> nameToClass = new ConcurrentHashMap<>(); /** * Load the local class equivalent of the specified stream class @@ -1013,7 +1013,7 @@ public class ObjectInputStream if (s0 != STREAM_MAGIC) { throw new StreamCorruptedException( - String.format("invalid stream header: %04X%04X, and FastSerializer is activated", s0, s1)); + String.format("invalid stream header: %04X%04X", s0, s1)); } if (!fastSerializerEscapeMode) { diff --git a/jdk/src/share/classes/java/io/ObjectOutputStream.java b/jdk/src/share/classes/java/io/ObjectOutputStream.java index 840f7fdc..23c1fff5 100644 --- a/jdk/src/share/classes/java/io/ObjectOutputStream.java +++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java @@ -234,11 +234,6 @@ public class ObjectOutputStream new sun.security.action.GetBooleanAction( "sun.io.serialization.extendedDebugInfo")).booleanValue(); - /** - * Magic number that is written to the stream header when using fastserilizer. - */ - private static final short STREAM_MAGIC_FAST = (short)0xdeca; - private static final Unsafe UNSAFE = Unsafe.getUnsafe(); /** @@ -255,6 +250,11 @@ public class ObjectOutputStream new sun.security.action.GetBooleanAction( "printFastSerializer")).booleanValue(); + /** + * Magic number that is written to the stream header when using fastserilizer. + */ + private static final short STREAM_MAGIC_FAST = (short)0xdeca; + /** * Creates an ObjectOutputStream that writes to the specified OutputStream. * This constructor writes the serialization stream header to the diff --git a/jdk/src/share/classes/sun/awt/FontConfiguration.java b/jdk/src/share/classes/sun/awt/FontConfiguration.java index 93e38e06..c2e94d15 100644 --- a/jdk/src/share/classes/sun/awt/FontConfiguration.java +++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java @@ -300,12 +300,7 @@ public abstract class FontConfiguration { } } foundOsSpecificFile = false; - - configFile = findImpl(baseName); - if (configFile != null) { - return configFile; - } - return null; + return (configFile = findImpl(baseName)); } /* Initialize the internal data tables from binary format font diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_cipher_rsa.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_cipher_rsa.c index 73b94cbe..d9b16ab9 100644 --- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_cipher_rsa.c +++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_cipher_rsa.c @@ -174,6 +174,7 @@ static int RSACryptOAEPPadding(JNIEnv* env, jlong keyAddress, jint inLen, jbyteA jbyte* inBytes = NULL; // outLen type should be size_t // EVP_PKEY_encrypt takes the outLen address as a parameter, and the parameter type is size_t* + // You can refer to the issue #2774 to see more content size_t outLen = 0; ENGINE* kaeEngine = GetEngineByAlgorithmIndex(RSA_INDEX); KAE_TRACE("RSACryptOAEPPadding: kaeEngine => %p", kaeEngine); @@ -366,7 +367,7 @@ JNIEXPORT jlong JNICALL Java_org_openeuler_security_openssl_KAERSACipher_nativeC } // set rsa public key params n and e - if(RSA_set0_key(rsa, bnN, bnE, NULL) <= 0) { + if (RSA_set0_key(rsa, bnN, bnE, NULL) <= 0) { KAE_ThrowFromOpenssl(env, "RSA_set0_key", KAE_ThrowRuntimeException); goto cleanup; } diff --git a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keyagreement_dh.c b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keyagreement_dh.c index 90b33045..d8d2ee7c 100644 --- a/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keyagreement_dh.c +++ b/jdk/src/solaris/native/org/openeuler/security/openssl/kae_keyagreement_dh.c @@ -131,9 +131,9 @@ cleanup: if (g_bn != NULL) KAE_ReleaseBigNumFromByteArray(g_bn); if (secret != NULL) - free(secret); + free(secret); if (computeKeyRetBn != NULL) - BN_free(computeKeyRetBn); + BN_free(computeKeyRetBn); return retByteArray; } diff --git a/jdk/test/micro/org/openeuler/bench/security/openssl/RSAKeyPairGeneratorBenchmark.java b/jdk/test/micro/org/openeuler/bench/security/openssl/RSAKeyPairGeneratorBenchmark.java index b1739222..13d3e8cf 100644 --- a/jdk/test/micro/org/openeuler/bench/security/openssl/RSAKeyPairGeneratorBenchmark.java +++ b/jdk/test/micro/org/openeuler/bench/security/openssl/RSAKeyPairGeneratorBenchmark.java @@ -54,7 +54,7 @@ public class RSAKeyPairGeneratorBenchmark extends BenchmarkBase { public KeyPair generateKeyPair() throws Exception { return keyPairGenerator.generateKeyPair(); } - + private KeyPairGenerator createKeyPairGenerator() throws Exception { if (prov != null) { return KeyPairGenerator.getInstance(algorithm, prov); -- 2.22.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2