--- old/src/hotspot/share/classfile/systemDictionary.cpp 2020-06-08 19:21:03.404068653 +0000 +++ new/src/hotspot/share/classfile/systemDictionary.cpp 2020-06-08 19:21:01.660025449 +0000 @@ -1427,6 +1427,8 @@ } InstanceKlass* new_ik = NULL; + // CFLH check is skipped for VM hidden or anonymous classes (see KlassFactory::create_from_stream). + // It will be skipped for shared VM hidden lambda proxy classes. if (!SystemDictionaryShared::is_hidden_lambda_proxy(ik)) { new_ik = KlassFactory::check_shared_class_file_load_hook( ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL); --- old/src/hotspot/share/classfile/systemDictionaryShared.cpp 2020-06-08 19:21:09.275214095 +0000 +++ new/src/hotspot/share/classfile/systemDictionaryShared.cpp 2020-06-08 19:21:07.570171857 +0000 @@ -97,24 +97,24 @@ InstanceKlass* _klass; bool _failed_verification; + bool _is_archived_lambda_proxy; int _id; int _clsfile_size; int _clsfile_crc32; GrowableArray* _verifier_constraints; GrowableArray* _verifier_constraint_flags; - bool _is_archived_lambda_proxy; GrowableArray* _loader_constraints; DumpTimeSharedClassInfo() { _klass = NULL; _failed_verification = false; + _is_archived_lambda_proxy = false; _id = -1; _clsfile_size = -1; _clsfile_crc32 = -1; _excluded = false; _verifier_constraints = NULL; _verifier_constraint_flags = NULL; - _is_archived_lambda_proxy = false; _loader_constraints = NULL; } @@ -321,25 +321,25 @@ class DumpTimeLambdaProxyClassInfo { public: - GrowableArray* _proxy_klass; - DumpTimeLambdaProxyClassInfo() : _proxy_klass(NULL) {} + GrowableArray* _proxy_klasses; + DumpTimeLambdaProxyClassInfo() : _proxy_klasses(NULL) {} void add_proxy_klass(InstanceKlass* proxy_klass) { - if (_proxy_klass == NULL) { - _proxy_klass = new (ResourceObj::C_HEAP, mtInternal)GrowableArray(5, true); + if (_proxy_klasses == NULL) { + _proxy_klasses = new (ResourceObj::C_HEAP, mtInternal)GrowableArray(5, true); } - assert(_proxy_klass != NULL, "sanity"); - _proxy_klass->append(proxy_klass); + assert(_proxy_klasses != NULL, "sanity"); + _proxy_klasses->append(proxy_klass); } }; class RunTimeLambdaProxyClassInfo { LambdaProxyClassKey _key; - InstanceKlass* _proxy_klass; + InstanceKlass* _proxy_klass_head; public: RunTimeLambdaProxyClassInfo(LambdaProxyClassKey key, InstanceKlass* proxy_klass) : - _key(key), _proxy_klass(proxy_klass) {} + _key(key), _proxy_klass_head(proxy_klass) {} - InstanceKlass* proxy_klass() const { return _proxy_klass; } + InstanceKlass* proxy_klass_head() const { return _proxy_klass_head; } // Used by LambdaProxyClassDictionary to implement OffsetCompactHashtable::EQUALS static inline bool EQUALS( @@ -349,8 +349,8 @@ void init(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) { _key = key; _key.original_to_target(); - _proxy_klass = DynamicArchive::original_to_target(info._proxy_klass->at(0)); - ArchivePtrMarker::mark_pointer(&_proxy_klass); + _proxy_klass_head = DynamicArchive::original_to_target(info._proxy_klasses->at(0)); + ArchivePtrMarker::mark_pointer(&_proxy_klass_head); } unsigned int hash() const { @@ -380,6 +380,7 @@ static void add_to_dump_time_lambda_proxy_class_dictionary(LambdaProxyClassKey key, InstanceKlass* proxy_klass) { + assert(DumpTimeTable_lock->owned_by_self(), "sanity"); if (_dumptime_lambda_proxy_class_dictionary == NULL) { _dumptime_lambda_proxy_class_dictionary = new (ResourceObj::C_HEAP, mtClass)DumpTimeLambdaProxyClassDictionary(); @@ -581,7 +582,6 @@ InstanceKlass* n_h = _klass->nest_host(THREAD); n_h = DynamicArchive::original_to_target(n_h); set_nest_host(n_h); - ArchivePtrMarker::mark_pointer(&n_h); } _klass = DynamicArchive::original_to_target(info._klass); } @@ -1338,7 +1338,7 @@ bool SystemDictionaryShared::is_registered_lambda_proxy_class(InstanceKlass* ik) { DumpTimeSharedClassInfo* info = _dumptime_table->get(ik); - return (info != NULL) ? info->_is_archived_lambda_proxy && !ik->is_non_strong_hidden() : false; + return (info != NULL) ? info->_is_archived_lambda_proxy : false; } bool SystemDictionaryShared::is_in_shared_lambda_proxy_table(InstanceKlass* ik) { @@ -1354,7 +1354,6 @@ bool SystemDictionaryShared::is_hidden_lambda_proxy(InstanceKlass* ik) { assert(ik->is_shared(), "applicable to only a shared class"); if (ik->is_hidden()) { - assert(is_in_shared_lambda_proxy_table(ik), "we don't archive other hidden classes"); return true; } else { return false; @@ -1604,7 +1603,7 @@ lambda_ik->assign_class_loader_type(); DumpTimeSharedClassInfo* info = _dumptime_table->get(lambda_ik); - if (info != NULL) { + if (info != NULL && !lambda_ik->is_non_strong_hidden()) { // Set _is_archived_lambda_proxy in DumpTimeSharedClassInfo so that the lambda_ik // won't be excluded during dumping of shared archive. See ExcludeDumpTimeSharedClasses. info->_is_archived_lambda_proxy = true; @@ -1631,7 +1630,7 @@ const RunTimeLambdaProxyClassInfo* info = _lambda_proxy_class_dictionary.lookup(&key, key.hash(), 0); InstanceKlass* proxy_klass = NULL; if (info != NULL) { - InstanceKlass* curr_klass = info->proxy_klass(); + InstanceKlass* curr_klass = info->proxy_klass_head(); InstanceKlass* prev_klass = curr_klass; if (curr_klass->lambda_proxy_is_available()) { while (curr_klass->next_link() != NULL) { @@ -1961,11 +1960,11 @@ CopyLambdaProxyClassInfoToArchive(CompactHashtableWriter* writer) : _writer(writer) {} bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) { - if (SystemDictionaryShared::is_excluded_class(info._proxy_klass->at(0))) { + if (SystemDictionaryShared::is_excluded_class(info._proxy_klasses->at(0))) { return true; } ResourceMark rm; - log_info(cds,dynamic)("Archiving hidden %s", info._proxy_klass->at(0)->external_name()); + log_info(cds,dynamic)("Archiving hidden %s", info._proxy_klasses->at(0)->external_name()); size_t byte_size = sizeof(RunTimeLambdaProxyClassInfo); RunTimeLambdaProxyClassInfo* runtime_info = (RunTimeLambdaProxyClassInfo*)MetaspaceShared::read_only_space_alloc(byte_size); @@ -1981,14 +1980,14 @@ public: AdjustLambdaProxyClassInfo() {} bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) { - if (SystemDictionaryShared::is_excluded_class(info._proxy_klass->at(0))) { + if (SystemDictionaryShared::is_excluded_class(info._proxy_klasses->at(0))) { return true; } - int len = info._proxy_klass->length(); + int len = info._proxy_klasses->length(); if (len > 1) { for (int i = 0; i < len-1; i++) { - InstanceKlass* ok0 = info._proxy_klass->at(i+0); // this is original klass - InstanceKlass* ok1 = info._proxy_klass->at(i+1); // this is original klass + InstanceKlass* ok0 = info._proxy_klasses->at(i+0); // this is original klass + InstanceKlass* ok1 = info._proxy_klasses->at(i+1); // this is original klass InstanceKlass* bk0 = DynamicArchive::original_to_buffer(ok0); InstanceKlass* bk1 = DynamicArchive::original_to_buffer(ok1); assert(bk0->next_link() == 0, "must be called after Klass::remove_unshareable_info()"); @@ -1998,7 +1997,7 @@ ArchivePtrMarker::mark_pointer(bk0->next_link_addr()); } } - DynamicArchive::original_to_buffer(info._proxy_klass->at(0))->set_lambda_proxy_is_available(); + DynamicArchive::original_to_buffer(info._proxy_klasses->at(0))->set_lambda_proxy_is_available(); return true; } }; @@ -2164,8 +2163,8 @@ void do_value(const RunTimeLambdaProxyClassInfo* record) { ResourceMark rm; - _st->print_cr("%4d: %s", (_index++), record->proxy_klass()->external_name()); - Klass* k = record->proxy_klass()->next_link(); + _st->print_cr("%4d: %s", (_index++), record->proxy_klass_head()->external_name()); + Klass* k = record->proxy_klass_head()->next_link(); while (k != NULL) { _st->print_cr("%4d: %s", (_index++), k->external_name()); k = k->next_link(); --- old/src/hotspot/share/oops/instanceKlass.hpp 2020-06-08 19:21:14.955354806 +0000 +++ new/src/hotspot/share/oops/instanceKlass.hpp 2020-06-08 19:21:13.163310412 +0000 @@ -479,9 +479,11 @@ Array* permitted_subclasses() const { return _permitted_subclasses; } void set_permitted_subclasses(Array* s) { _permitted_subclasses = s; } +private: // Called to verify that k is a member of this nest - does not look at k's nest-host bool has_nest_member(InstanceKlass* k, TRAPS) const; +public: // Used to construct informative IllegalAccessError messages at a higher level, // if there was an issue resolving or validating the nest host. // Returns NULL if there was no error. --- old/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java 2020-06-08 19:21:21.668521107 +0000 +++ new/src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java 2020-06-08 19:21:19.528468092 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/BasicLambdaTest.java 2020-06-08 19:21:28.170682181 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/BasicLambdaTest.java 2020-06-08 19:21:26.424638927 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/CDSStreamTestDriver.java 2020-06-08 19:21:34.310834287 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/CDSStreamTestDriver.java 2020-06-08 19:21:32.324785087 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DoubleSumAverageTest.java 2020-06-08 19:21:40.851996327 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DoubleSumAverageTest.java 2020-06-08 19:21:38.555939448 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaForClassInBaseArchive.java 2020-06-08 19:21:48.328181529 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaForClassInBaseArchive.java 2020-06-08 19:21:46.116126732 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ParallelLambdaLoadTest.java 2020-06-08 19:21:55.263353330 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/ParallelLambdaLoadTest.java 2020-06-08 19:21:53.589311860 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/PredicateTest.java 2020-06-08 19:22:01.663511877 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/PredicateTest.java 2020-06-08 19:21:59.961469713 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/StaticInnerTest.java 2020-06-08 19:22:07.986668517 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/StaticInnerTest.java 2020-06-08 19:22:06.291626527 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UsedAllArchivedLambdas.java 2020-06-08 19:22:16.104869624 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/UsedAllArchivedLambdas.java 2020-06-08 19:22:13.574806948 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/BasicLambdaApp.java 2020-06-08 19:22:23.441051358 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/BasicLambdaApp.java 2020-06-08 19:22:21.544004364 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/LambdaVerification.java 2020-06-08 19:22:29.494201309 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/LambdaVerification.java 2020-06-08 19:22:27.665155999 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/ParallelLambdaLoad.java 2020-06-08 19:22:36.845383415 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/ParallelLambdaLoad.java 2020-06-08 19:22:35.111340459 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/PredicateApp.java 2020-06-08 19:22:40.758480352 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/PredicateApp.java 2020-06-08 19:22:39.637452581 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/SimpleApp.java 2020-06-08 19:22:44.157564555 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/SimpleApp.java 2020-06-08 19:22:43.200540848 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/UsedAllArchivedLambdasApp.java 2020-06-08 19:22:47.449646108 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/test-classes/UsedAllArchivedLambdasApp.java 2020-06-08 19:22:46.485622227 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 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 --- old/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java 2020-06-08 19:22:50.743727710 +0000 +++ new/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java 2020-06-08 19:22:49.795704225 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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