From 9cc1409e77e6cf5391436370728b3b5be9b4a9eb Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Tue, 17 Dec 2024 18:12:28 +0100 Subject: [PATCH 1/6] Fix javadoc --- .../src/com/oracle/graal/pointsto/meta/AnalysisElement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisElement.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisElement.java index 0bbebc55503b..e7c22c5d102f 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisElement.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisElement.java @@ -398,7 +398,7 @@ private boolean processReason(Object current, String prefix) { } else if (current instanceof ResolvedJavaField field) { /** - * In {@link AnalysisUniverse#lookupAllowUnresolved(JavaField}} we may register a + * In {@link AnalysisUniverse#lookupAllowUnresolved(JavaField)} we may register a * ResolvedJavaField as reason. * * We convert it to AnalysisField to print more information about why the field is From 8e4ce6ce75620a882745e268e2e89838b450f1a3 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Thu, 31 Oct 2024 17:45:51 +0100 Subject: [PATCH 2/6] Move espresso shared code to a separate suite --- espresso-shared/mx.espresso-shared/suite.py | 132 ++++++++++ .../.checkstyle_checks.xml | 235 ++++++++++++++++++ .../espresso/classfile/ClassfileParser.java | 0 .../espresso/classfile/ClassfileStream.java | 0 .../espresso/classfile/ClasspathEntry.java | 0 .../espresso/classfile/ClasspathFile.java | 0 .../espresso/classfile/ConstantPool.java | 0 .../truffle/espresso/classfile/Constants.java | 0 .../espresso/classfile/ExceptionHandler.java | 0 .../truffle/espresso/classfile/JavaKind.java | 0 .../espresso/classfile/JavaVersion.java | 0 .../classfile/ParserConstantPool.java | 0 .../espresso/classfile/ParserException.java | 0 .../espresso/classfile/ParserField.java | 0 .../espresso/classfile/ParserKlass.java | 0 .../espresso/classfile/ParserMethod.java | 0 .../espresso/classfile/ParsingContext.java | 0 .../classfile/attributes/Attribute.java | 0 .../attributes/BootstrapMethodsAttribute.java | 0 .../classfile/attributes/CodeAttribute.java | 0 .../attributes/ConstantValueAttribute.java | 0 .../attributes/EnclosingMethodAttribute.java | 0 .../attributes/ExceptionsAttribute.java | 0 .../attributes/InnerClassesAttribute.java | 0 .../attributes/LineNumberTableAttribute.java | 0 .../attributes/LineNumberTableRef.java | 0 .../espresso/classfile/attributes/Local.java | 0 .../classfile/attributes/LocalRef.java | 0 .../attributes/LocalVariableTable.java | 0 .../attributes/LocalVariableTableRef.java | 0 .../attributes/MethodParametersAttribute.java | 0 .../attributes/NestHostAttribute.java | 0 .../attributes/NestMembersAttribute.java | 0 .../PermittedSubclassesAttribute.java | 0 .../classfile/attributes/RecordAttribute.java | 0 .../attributes/SignatureAttribute.java | 0 .../SourceDebugExtensionAttribute.java | 0 .../attributes/SourceFileAttribute.java | 0 .../attributes/StackMapTableAttribute.java | 0 .../bytecode/BytecodeLookupSwitch.java | 0 .../classfile/bytecode/BytecodeStream.java | 0 .../classfile/bytecode/BytecodeSwitch.java | 0 .../bytecode/BytecodeTableSwitch.java | 0 .../classfile/bytecode/Bytecodes.java | 0 .../espresso/classfile/bytecode/Bytes.java | 0 .../bytecode/VolatileArrayAccess.java | 0 .../classfile/descriptors/ByteSequence.java | 0 .../classfile/descriptors/Descriptor.java | 0 .../classfile/descriptors/ErrorUtil.java | 0 .../classfile/descriptors/ModifiedUTF8.java | 0 .../espresso/classfile/descriptors/Name.java | 0 .../classfile/descriptors/NameSymbols.java | 0 .../classfile/descriptors/ParserSymbols.java | 0 .../classfile/descriptors/Signature.java | 0 .../descriptors/SignatureSymbols.java | 0 .../classfile/descriptors/StaticSymbols.java | 0 .../classfile/descriptors/Symbol.java | 0 .../classfile/descriptors/Symbols.java | 0 .../classfile/descriptors/SymbolsImpl.java | 0 .../espresso/classfile/descriptors/Type.java | 0 .../classfile/descriptors/TypeSymbols.java | 0 .../classfile/descriptors/Utf8Symbols.java | 0 .../classfile/descriptors/Validation.java | 0 .../descriptors/ValidationException.java | 0 .../classfile/perf/DebugCloseable.java | 0 .../espresso/classfile/perf/DebugCounter.java | 0 .../espresso/classfile/perf/DebugTimer.java | 0 .../classfile/perf/TimerCollection.java | 0 .../classfile/perf/TimerCollectionImpl.java | 0 .../classfile/tables/AbstractModuleTable.java | 0 .../tables/AbstractPackageTable.java | 0 .../espresso/classfile/tables/EntryTable.java | 0 .../espresso/shared/meta/ErrorType.java | 0 .../espresso/shared/meta/FieldAccess.java | 0 .../espresso/shared/meta/KnownTypes.java | 0 .../espresso/shared/meta/MemberAccess.java | 0 .../espresso/shared/meta/MethodAccess.java | 0 .../shared/meta/ModifiersProvider.java | 0 .../truffle/espresso/shared/meta/Named.java | 0 .../espresso/shared/meta/RuntimeAccess.java | 0 .../truffle/espresso/shared/meta/Signed.java | 0 .../espresso/shared/meta/SymbolPool.java | 0 .../espresso/shared/meta/TypeAccess.java | 0 .../espresso/shared/resolver/CallKind.java | 0 .../shared/resolver/CallSiteType.java | 0 .../shared/resolver/FieldAccessType.java | 0 .../shared/resolver/LinkResolver.java | 0 .../shared/resolver/ResolvedCall.java | 0 .../shared/verifier/MethodVerifier.java | 0 .../espresso/shared/verifier/Operand.java | 0 .../espresso/shared/verifier/StackFrame.java | 0 .../shared/verifier/StackMapFrame.java | 0 .../shared/verifier/StackMapFrameParser.java | 0 .../verifier/VerificationException.java | 0 .../shared/verifier/VerificationTypeInfo.java | 0 .../espresso/shared/verifier/Verifier.java | 0 .../shared/verifier/VerifierError.java | 0 .../shared/vtable/FailingPartialMethod.java | 0 .../shared/vtable/MethodTableException.java | 0 .../espresso/shared/vtable/PartialMethod.java | 0 .../espresso/shared/vtable/PartialType.java | 0 .../espresso/shared/vtable/Tables.java | 0 .../espresso/shared/vtable/VTable.java | 0 espresso/ci/ci.jsonnet | 8 + espresso/ci/ci_common/common.jsonnet | 17 +- espresso/mx.espresso/mx_espresso.py | 2 +- espresso/mx.espresso/suite.py | 36 +-- sulong/ci/ci.jsonnet | 1 + 108 files changed, 396 insertions(+), 35 deletions(-) create mode 100644 espresso-shared/mx.espresso-shared/suite.py create mode 100644 espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java (100%) rename {espresso => espresso-shared}/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java (100%) diff --git a/espresso-shared/mx.espresso-shared/suite.py b/espresso-shared/mx.espresso-shared/suite.py new file mode 100644 index 000000000000..a2f2f77e68e9 --- /dev/null +++ b/espresso-shared/mx.espresso-shared/suite.py @@ -0,0 +1,132 @@ +# +# Copyright (c) 2025, 2025, 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. +# + +suite = { + "mxversion": "7.38.0", + "name": "espresso-shared", + "version" : "25.0.0", + "release" : False, + "groupId" : "org.graalvm.espresso", + "url" : "https://www.graalvm.org/reference-manual/java-on-truffle/", + "developer" : { + "name" : "GraalVM Development", + "email" : "graalvm-dev@oss.oracle.com", + "organization" : "Oracle Corporation", + "organizationUrl" : "http://www.graalvm.org/", + }, + "scm" : { + "url" : "https://github.com/oracle/graal/tree/master/espresso-shared", + "read" : "https://github.com/oracle/graal.git", + "write" : "git@github.com:oracle/graal.git", + }, + + # ------------- licenses + + "licenses": { + "GPLv2": { + "name": "GNU General Public License, version 2", + "url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" + }, + "UPL": { + "name": "Universal Permissive License, Version 1.0", + "url": "http://opensource.org/licenses/UPL", + }, + "Oracle Proprietary": { + "name": "ORACLE PROPRIETARY/CONFIDENTIAL", + "url": "http://www.oracle.com/us/legal/copyright/index.html" + }, + }, + "defaultLicense": "GPLv2", + + # ------------- imports + + "imports": { + "suites": [ + { + "name": "truffle", + "subdir": True, + }, + { + "name" : "sdk", + "subdir": True, + }, + ], + }, + + # ------------- projects + + "projects": { + # Shared .class file parser + "com.oracle.truffle.espresso.classfile": { + "subDir": "src", + "sourceDirs": ["src"], + "dependencies": [ + "sdk:COLLECTIONS", + ], + "buildDependencies": [ + "truffle:TRUFFLE_API", + ], + "javaCompliance" : "17+", + "checkstyle": "com.oracle.truffle.espresso.classfile", + "checkstyleVersion": "10.21.0", + }, + + # Shared link resolver + "com.oracle.truffle.espresso.shared": { + "subDir": "src", + "sourceDirs": ["src"], + "dependencies": [ + "com.oracle.truffle.espresso.classfile", + ], + "javaCompliance" : "17+", + "checkstyle": "com.oracle.truffle.espresso.classfile", + }, + }, + + # ------------- distributions + + "distributions": { + "ESPRESSO_SHARED": { + "moduleInfo" : { + "name" : "org.graalvm.espresso.shared", + "exports": [ + "* to org.graalvm.espresso, org.graalvm.nativeimage.builder", + ], + }, + "description" : "Shared code runtime class loading", + "subDir": "src", + "dependencies": [ + "com.oracle.truffle.espresso.classfile", + "com.oracle.truffle.espresso.shared", + ], + "distDependencies": [ + "sdk:COLLECTIONS", + ], + "maven" : { + "tag": ["default", "public"], + }, + "useModulePath": True, + "noMavenJavadoc": True, + }, + } +} diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml b/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml new file mode 100644 index 000000000000..c34e25ad18b8 --- /dev/null +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml @@ -0,0 +1,235 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java rename to espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java similarity index 100% rename from espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java rename to espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java diff --git a/espresso/ci/ci.jsonnet b/espresso/ci/ci.jsonnet index 26eca162e140..2b470f72b0e8 100644 --- a/espresso/ci/ci.jsonnet +++ b/espresso/ci/ci.jsonnet @@ -24,10 +24,18 @@ }, }, + local espresso_shared_gate = common.eclipse + common.jdt + common.predicates(false, false, false, false) + + common.espresso_gate(allow_warnings=false, tags='style,fullbuild', timelimit='35:00', name='gate-espresso-shared-style-jdkLatest-linux-amd64') + { + setup+: [ + ['cd', "../espresso-shared"], + ], + }, + local _builds = common.builds + [ # [GR-64739] move espresso JDK 21 gates to on demand # common.jdk21_gate_linux_amd64 + espresso_compiler_stub_gate, common.jdk21_on_demand_linux + espresso_compiler_stub_gate, + common.jdkLatest_gate_linux_amd64 + espresso_shared_gate, // Benchmarks // AWFY peak perf. benchmarks common.jdk21_weekly_bench_linux + common.espresso_benchmark('jvm-ce-llvm', 'awfy:*' , extra_args=['--vm.Xmx1g', '--vm.Xms1g']) + {name: 'weekly-bench-espresso-jvm-ce-awfy-jdk21onLatest-linux-amd64'}, diff --git a/espresso/ci/ci_common/common.jsonnet b/espresso/ci/ci_common/common.jsonnet index d476165f5ee7..72f0645146e3 100644 --- a/espresso/ci/ci_common/common.jsonnet +++ b/espresso/ci/ci_common/common.jsonnet @@ -66,22 +66,24 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo']; }, }, - predicates(with_compiler, with_native_image, with_vm): { + predicates(with_compiler, with_native_image, with_vm, with_espresso=true): { assert !with_native_image || with_compiler, guard+: { includes: [ "/.git/**", # This ensure the .git directory is preserved in apply-predicates + "/pyproject.toml", + "/common.json", + "/ci.jsonnet", + "/ci/**", "/sdk/**", "/truffle/**", + "/espresso-shared/**", + ] + base.basic_guard_includes + (if with_espresso then [ "/espresso/**", "/tools/**", "/regex/**", "/sulong/**", - "/pyproject.toml", - "/common.json", - "/ci.jsonnet", - "/ci/**", - ] + base.basic_guard_includes + (if with_compiler then [ + ] else []) + (if with_compiler then [ "/compiler/**", ] + base.compiler_guard_includes else []) + (if with_native_image then [ "/substratevm/**", @@ -115,10 +117,13 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo']; darwin_aarch64_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.darwin_aarch64, windows_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.windows + devkits["windows-jdk-latest"], + linux_amd64_latest: graal_common.labsjdkLatest + self.linux_amd64, + linux_amd64_graalvm21: self.espresso_jdk_21 + graal_common.graalvmee21 + self.espresso_jdk_21_llvm + self.linux_amd64, // precise targets and capabilities + jdkLatest_gate_linux_amd64 : self.gate + self.linux_amd64_latest, jdk21_gate_linux_amd64 : self.gate + self.linux_amd64_21, jdk21_gate_linux_aarch64 : self.gate + self.linux_aarch64_21, jdk21_gate_darwin_amd64 : self.gate + self.darwin_amd64_21, diff --git a/espresso/mx.espresso/mx_espresso.py b/espresso/mx.espresso/mx_espresso.py index 7a76af2c4222..9abf8bed8ff4 100644 --- a/espresso/mx.espresso/mx_espresso.py +++ b/espresso/mx.espresso/mx_espresso.py @@ -436,7 +436,7 @@ def contents(self): license_files=['LICENSE_JAVAONTRUFFLE'], third_party_license_files=[], dependencies=['Truffle', 'nfi-libffi', 'ejvm'], - truffle_jars=['espresso:ESPRESSO'], + truffle_jars=['espresso:ESPRESSO', 'espresso-shared:ESPRESSO_SHARED'], support_distributions=['espresso:ESPRESSO_GRAALVM_SUPPORT'], library_configs=[espresso_library_config], polyglot_lib_jar_dependencies=['espresso:LIB_JAVAVM'], diff --git a/espresso/mx.espresso/suite.py b/espresso/mx.espresso/suite.py index 696385de85d1..74611b590e81 100644 --- a/espresso/mx.espresso/suite.py +++ b/espresso/mx.espresso/suite.py @@ -74,6 +74,10 @@ "name" : "sdk", "subdir": True, }, + { + "name" : "espresso-shared", + "subdir": True, + }, ], }, @@ -122,32 +126,6 @@ "license": "UPL", }, - # Shared .class file parser - "com.oracle.truffle.espresso.classfile": { - "subDir": "src", - "sourceDirs": ["src"], - "dependencies": [ - "truffle:TRUFFLE_API", - ], - "requires": [ - ], - "javaCompliance" : "17+", - "checkstyle": "com.oracle.truffle.espresso", - }, - - # Shared link resolver - "com.oracle.truffle.espresso.shared": { - "subDir": "src", - "sourceDirs": ["src"], - "dependencies": [ - "com.oracle.truffle.espresso.classfile", - ], - "requires": [ - ], - "javaCompliance" : "17+", - "checkstyle": "com.oracle.truffle.espresso", - }, - "com.oracle.truffle.espresso": { "subDir": "src", "sourceDirs": ["src"], @@ -156,7 +134,7 @@ "truffle:TRUFFLE_NFI", "com.oracle.truffle.espresso.jdwp", "com.oracle.truffle.espresso.shadowed.asm", - "com.oracle.truffle.espresso.shared", + "espresso-shared:ESPRESSO_SHARED", ], "requires": [ "java.logging", @@ -224,7 +202,7 @@ "subDir": "src", "sourceDirs": ["src"], "dependencies": [ - "com.oracle.truffle.espresso.classfile", + "espresso-shared:ESPRESSO_SHARED", "truffle:TRUFFLE_API", "truffle:TRUFFLE_NFI", ], @@ -476,6 +454,7 @@ "org.graalvm.collections", "org.graalvm.nativeimage", "org.graalvm.polyglot", + "org.graalvm.espresso.shared", ], }, "description" : "Core module of the Java on Truffle (aka Espresso): a Java bytecode interpreter", @@ -486,6 +465,7 @@ "distDependencies": [ "truffle:TRUFFLE_API", "truffle:TRUFFLE_NFI", + "espresso-shared:ESPRESSO_SHARED", ], "maven" : { "artifactId" : "espresso-language", diff --git a/sulong/ci/ci.jsonnet b/sulong/ci/ci.jsonnet index c422f030782f..a288029127af 100644 --- a/sulong/ci/ci.jsonnet +++ b/sulong/ci/ci.jsonnet @@ -43,6 +43,7 @@ local sc = (import "ci_common/sulong-common.jsonnet"); "/tools/**", # substratevm and its dependencies "/substratevm/**", + "/espresso-shared/**", # vm and its dependencies "/vm/**", ] else []) + (if style then [ From 9377b7b810fcbfa3b96d4f113e40db440b468a97 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Mon, 17 Feb 2025 15:24:51 +0100 Subject: [PATCH 3/6] espresso-shared: apply CPE --- espresso-shared/mx.espresso-shared/suite.py | 5 +++-- .../.checkstyle_checks.xml | 3 ++- .../oracle/truffle/espresso/classfile/ClassfileParser.java | 4 +++- .../oracle/truffle/espresso/classfile/ClassfileStream.java | 4 +++- .../oracle/truffle/espresso/classfile/ClasspathEntry.java | 4 +++- .../com/oracle/truffle/espresso/classfile/ClasspathFile.java | 4 +++- .../com/oracle/truffle/espresso/classfile/ConstantPool.java | 4 +++- .../src/com/oracle/truffle/espresso/classfile/Constants.java | 4 +++- .../oracle/truffle/espresso/classfile/ExceptionHandler.java | 4 +++- .../src/com/oracle/truffle/espresso/classfile/JavaKind.java | 4 +++- .../com/oracle/truffle/espresso/classfile/JavaVersion.java | 4 +++- .../truffle/espresso/classfile/ParserConstantPool.java | 4 +++- .../oracle/truffle/espresso/classfile/ParserException.java | 4 +++- .../com/oracle/truffle/espresso/classfile/ParserField.java | 4 +++- .../com/oracle/truffle/espresso/classfile/ParserKlass.java | 4 +++- .../com/oracle/truffle/espresso/classfile/ParserMethod.java | 4 +++- .../oracle/truffle/espresso/classfile/ParsingContext.java | 4 +++- .../truffle/espresso/classfile/attributes/Attribute.java | 4 +++- .../classfile/attributes/BootstrapMethodsAttribute.java | 4 +++- .../truffle/espresso/classfile/attributes/CodeAttribute.java | 4 +++- .../classfile/attributes/ConstantValueAttribute.java | 4 +++- .../classfile/attributes/EnclosingMethodAttribute.java | 4 +++- .../espresso/classfile/attributes/ExceptionsAttribute.java | 4 +++- .../espresso/classfile/attributes/InnerClassesAttribute.java | 4 +++- .../classfile/attributes/LineNumberTableAttribute.java | 4 +++- .../espresso/classfile/attributes/LineNumberTableRef.java | 4 +++- .../oracle/truffle/espresso/classfile/attributes/Local.java | 4 +++- .../truffle/espresso/classfile/attributes/LocalRef.java | 4 +++- .../espresso/classfile/attributes/LocalVariableTable.java | 4 +++- .../espresso/classfile/attributes/LocalVariableTableRef.java | 4 +++- .../classfile/attributes/MethodParametersAttribute.java | 4 +++- .../espresso/classfile/attributes/NestHostAttribute.java | 4 +++- .../espresso/classfile/attributes/NestMembersAttribute.java | 4 +++- .../classfile/attributes/PermittedSubclassesAttribute.java | 4 +++- .../espresso/classfile/attributes/RecordAttribute.java | 4 +++- .../espresso/classfile/attributes/SignatureAttribute.java | 4 +++- .../classfile/attributes/SourceDebugExtensionAttribute.java | 4 +++- .../espresso/classfile/attributes/SourceFileAttribute.java | 4 +++- .../classfile/attributes/StackMapTableAttribute.java | 4 +++- .../espresso/classfile/bytecode/BytecodeLookupSwitch.java | 4 +++- .../truffle/espresso/classfile/bytecode/BytecodeStream.java | 4 +++- .../truffle/espresso/classfile/bytecode/BytecodeSwitch.java | 4 +++- .../espresso/classfile/bytecode/BytecodeTableSwitch.java | 4 +++- .../truffle/espresso/classfile/bytecode/Bytecodes.java | 4 +++- .../oracle/truffle/espresso/classfile/bytecode/Bytes.java | 4 +++- .../espresso/classfile/bytecode/VolatileArrayAccess.java | 4 +++- .../truffle/espresso/classfile/descriptors/ByteSequence.java | 4 +++- .../truffle/espresso/classfile/descriptors/Descriptor.java | 4 +++- .../truffle/espresso/classfile/descriptors/ErrorUtil.java | 4 +++- .../truffle/espresso/classfile/descriptors/ModifiedUTF8.java | 4 +++- .../oracle/truffle/espresso/classfile/descriptors/Name.java | 4 +++- .../truffle/espresso/classfile/descriptors/NameSymbols.java | 4 +++- .../espresso/classfile/descriptors/ParserSymbols.java | 4 +++- .../truffle/espresso/classfile/descriptors/Signature.java | 4 +++- .../espresso/classfile/descriptors/SignatureSymbols.java | 4 +++- .../espresso/classfile/descriptors/StaticSymbols.java | 4 +++- .../truffle/espresso/classfile/descriptors/Symbol.java | 4 +++- .../truffle/espresso/classfile/descriptors/Symbols.java | 4 +++- .../truffle/espresso/classfile/descriptors/SymbolsImpl.java | 4 +++- .../oracle/truffle/espresso/classfile/descriptors/Type.java | 4 +++- .../truffle/espresso/classfile/descriptors/TypeSymbols.java | 4 +++- .../truffle/espresso/classfile/descriptors/Utf8Symbols.java | 4 +++- .../truffle/espresso/classfile/descriptors/Validation.java | 4 +++- .../espresso/classfile/descriptors/ValidationException.java | 4 +++- .../truffle/espresso/classfile/perf/DebugCloseable.java | 4 +++- .../oracle/truffle/espresso/classfile/perf/DebugCounter.java | 4 +++- .../oracle/truffle/espresso/classfile/perf/DebugTimer.java | 4 +++- .../truffle/espresso/classfile/perf/TimerCollection.java | 4 +++- .../truffle/espresso/classfile/perf/TimerCollectionImpl.java | 4 +++- .../espresso/classfile/tables/AbstractModuleTable.java | 4 +++- .../espresso/classfile/tables/AbstractPackageTable.java | 4 +++- .../oracle/truffle/espresso/classfile/tables/EntryTable.java | 4 +++- .../com/oracle/truffle/espresso/shared/meta/ErrorType.java | 4 +++- .../com/oracle/truffle/espresso/shared/meta/FieldAccess.java | 4 +++- .../com/oracle/truffle/espresso/shared/meta/KnownTypes.java | 4 +++- .../oracle/truffle/espresso/shared/meta/MemberAccess.java | 4 +++- .../oracle/truffle/espresso/shared/meta/MethodAccess.java | 4 +++- .../truffle/espresso/shared/meta/ModifiersProvider.java | 4 +++- .../src/com/oracle/truffle/espresso/shared/meta/Named.java | 4 +++- .../oracle/truffle/espresso/shared/meta/RuntimeAccess.java | 4 +++- .../src/com/oracle/truffle/espresso/shared/meta/Signed.java | 4 +++- .../com/oracle/truffle/espresso/shared/meta/SymbolPool.java | 4 +++- .../com/oracle/truffle/espresso/shared/meta/TypeAccess.java | 4 +++- .../oracle/truffle/espresso/shared/resolver/CallKind.java | 4 +++- .../truffle/espresso/shared/resolver/CallSiteType.java | 4 +++- .../truffle/espresso/shared/resolver/FieldAccessType.java | 4 +++- .../truffle/espresso/shared/resolver/LinkResolver.java | 4 +++- .../truffle/espresso/shared/resolver/ResolvedCall.java | 4 +++- .../truffle/espresso/shared/verifier/MethodVerifier.java | 4 +++- .../com/oracle/truffle/espresso/shared/verifier/Operand.java | 4 +++- .../oracle/truffle/espresso/shared/verifier/StackFrame.java | 4 +++- .../truffle/espresso/shared/verifier/StackMapFrame.java | 4 +++- .../espresso/shared/verifier/StackMapFrameParser.java | 4 +++- .../espresso/shared/verifier/VerificationException.java | 4 +++- .../espresso/shared/verifier/VerificationTypeInfo.java | 4 +++- .../oracle/truffle/espresso/shared/verifier/Verifier.java | 4 +++- .../truffle/espresso/shared/verifier/VerifierError.java | 4 +++- .../truffle/espresso/shared/vtable/FailingPartialMethod.java | 4 +++- .../truffle/espresso/shared/vtable/MethodTableException.java | 4 +++- .../oracle/truffle/espresso/shared/vtable/PartialMethod.java | 4 +++- .../oracle/truffle/espresso/shared/vtable/PartialType.java | 4 +++- .../com/oracle/truffle/espresso/shared/vtable/Tables.java | 4 +++- .../com/oracle/truffle/espresso/shared/vtable/VTable.java | 4 +++- 103 files changed, 308 insertions(+), 104 deletions(-) diff --git a/espresso-shared/mx.espresso-shared/suite.py b/espresso-shared/mx.espresso-shared/suite.py index a2f2f77e68e9..9339238cc0dd 100644 --- a/espresso-shared/mx.espresso-shared/suite.py +++ b/espresso-shared/mx.espresso-shared/suite.py @@ -4,7 +4,9 @@ # # 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. +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. # # This code is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -20,7 +22,6 @@ # or visit www.oracle.com if you need additional information or have any # questions. # - suite = { "mxversion": "7.38.0", "name": "espresso-shared", diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml b/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml index c34e25ad18b8..8bcc56de8cbd 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/.checkstyle_checks.xml @@ -204,7 +204,8 @@ - + + diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java index efbad6bb3841..32f33c0a838f 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java index 9fba36971d65..6b75c1c540ff 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileStream.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java index 27eaab3f2aa8..49930c84adf5 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathEntry.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java index aba19859bcc8..92baf342b0d4 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClasspathFile.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java index 1a82961c56b4..cfe5546475cb 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java index 7001edacbbfc..1c7f62dfc598 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/Constants.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java index 90f4f3650cb0..f59de315d0df 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java index 972cb587efe0..e23ca402ef31 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java index 5b37c565444e..e275b92659cf 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java index 9cbf4721d7ee..d9cbd23ed11a 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserConstantPool.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java index 1214ead35208..b17c4b3dc2f3 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserException.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java index 4c2c5aa2367c..265de55b7366 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java index fab1f49212ee..07d7656bb0b5 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java index 1eafb80b1439..0c444ce27df8 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java index 0860b578f33d..4ae0799e9f64 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java index 69e19d80ebf0..06e0d505b574 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java index 5087be7761a4..2f248dc01fe9 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java index 8d9c07adc294..2aebeefad8d9 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java index f5f9d006fd6e..bc794da4ba38 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java index 0e3b373ec7c1..f96d2179a439 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java index 291afcc950a1..231246c1d1f6 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java index 017abeaf0092..bba82849b4d4 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java index b645e9019e73..49cf7a7a8a7e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java index 0e616a0c7d25..0a961bd40c46 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableRef.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java index 3714d9839685..d6d669d0b55b 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java index 37907ad85f25..bcfdc828ec3e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalRef.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java index bc979d4136d1..c2245493c4be 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java index 732d32f38b2d..e2f74794f05b 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTableRef.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java index bb6ff45f1d0d..0833f9e9357f 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java index 8c0801351c8d..4f2c36e72b2e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java index 86019d866254..9c4b10844055 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java index f297f7fd31cc..293c6dd7aabb 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java index 63130800bd38..55c48137b33d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java index e62d17e2ad7b..85ad5d4a0911 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java index c060071d37ee..cd0807b44201 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java index 4ea138f9a3a5..784bf946123d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java index ef241e4fe50b..c54370fa6285 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java index f09a7e583a4a..3162a2ff92ac 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeLookupSwitch.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java index c8063d38684e..185403327eba 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeStream.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java index a46dfb9aabfb..69dd606c9ef1 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeSwitch.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java index ec24784d49dd..2cd6b703b809 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/BytecodeTableSwitch.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java index 044da8e9cda2..46238db74cdf 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytecodes.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java index 65a874ae3d20..948c4a5062f1 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/Bytes.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java index a57d5ee10891..4efa2f544cd2 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/bytecode/VolatileArrayAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java index bd5903925a97..da9eaa515921 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java index f811d075c2a7..1799aeece69d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java index 73c5c72a8508..924c2f7bb6e7 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ErrorUtil.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java index 437b6f746414..7c87f538d5d1 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java index 6af6847e3c6d..91d44ca21533 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java index 33661cb04c1f..1b836520dc32 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java index 196185d180bd..a531f7b81490 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java index a21fa3528cec..eed6fead704e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java index 4caf441aeb14..0f1d09b8dc54 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java index 9e3227eb0063..792a387e3944 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java index ea48bcf21f82..7286b1297146 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java index f4db6365584a..5222f7baef6c 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java index b86d9788ee47..a44adea4d693 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java index 11b1979729ce..17b8bb6cfa1d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java index 8e40b34528dd..5137140c34aa 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java index a958f6c65dc1..5d11f5ce70c7 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Utf8Symbols.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java index 2f4097e5e8fb..ac6146356461 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java index 17ea32b19c29..f1ac308f21f9 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ValidationException.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java index 60ba2f48f2f0..1aaebb292b66 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCloseable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java index 315fbd256b81..917b2944f081 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugCounter.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java index fc719fcf811f..52d3712223fc 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java index 2fee1bc9e08c..51a4a2b2520e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java index 2461bd4a4b21..71d52ab2afc5 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java index 5898a237b5d5..e034cda1bae9 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java index 4b7caaf5a8cd..eff698dc6df6 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java index 4143a993a124..ee9eb4187891 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java index 8248ff7693b4..4219ccf87b46 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ErrorType.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java index 68c90a1203ee..4fbdd2930e84 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/FieldAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java index 6028848256db..e89ee4b7edfa 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/KnownTypes.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java index aaf81ce2232c..4dab77ee04c8 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MemberAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java index a25a71b91357..7f736162b095 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java index 323db64cb4cb..aeed5499636c 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/ModifiersProvider.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java index e838223a003b..7efaf2ff9bdb 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java index 34ee6efa1aec..210c16150795 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java index ca0f8d8d36a4..1d295b1e8468 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Signed.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java index f21afb020938..303e2e43b93d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java index 3e9d8f83dcd0..13b556142cad 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java index 7c68160000d4..a9af8bac992e 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallKind.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java index 7aa1e2e25690..b9848d5428de 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/CallSiteType.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java index ee07681180df..cca1f2d5bb8c 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/FieldAccessType.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java index 3e935b23df99..7aeac3cef95a 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java index f5e8ddf32d16..9556831a04b0 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/ResolvedCall.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java index 6e960e2b985a..7c3a9051d0af 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java index 85adc02aea9d..8bc99c873bcb 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java index 0fc20a80292a..38d1b9323e91 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java index cd60555058b2..0743e637d1f7 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrame.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java index 014837ce9f48..cf22ffc405d8 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackMapFrameParser.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java index 2d190fcaaa0b..15c09b7fa0fb 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationException.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java index d27011946d4e..6b1afdb7be9f 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java index 4bee8341ced8..561bb375e7f0 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Verifier.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java index a24ae4ab3ddb..84e947050df5 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerifierError.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java index c2eb7f753dfc..175859088fb1 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/FailingPartialMethod.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java index f35a01774990..eb261981a458 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/MethodTableException.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java index 3f1b393a94f3..06e7301c534d 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialMethod.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java index 0612742a98b4..4bfdc11e9dca 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/PartialType.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java index 6d94a39491ed..335616839259 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/Tables.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or diff --git a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java index 0b28863a55d5..cd95b89572be 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/vtable/VTable.java @@ -4,7 +4,9 @@ * * 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. + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or From a034fddf21aa0dafee794f3057388c1303bfa4c9 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Sat, 22 Feb 2025 11:45:14 +0100 Subject: [PATCH 4/6] Avoid usage of TruffleLogger in espresso.classfile --- .../truffle/espresso/classfile/perf/DebugTimer.java | 10 +++++----- .../espresso/classfile/perf/TimerCollection.java | 4 ++-- .../espresso/classfile/perf/TimerCollectionImpl.java | 9 ++++----- .../espresso/runtime/EspressoShutdownHandler.java | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java index 52d3712223fc..25738bda4903 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/DebugTimer.java @@ -27,9 +27,9 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Consumer; import java.util.function.Supplier; -import com.oracle.truffle.api.TruffleLogger; import com.oracle.truffle.espresso.classfile.descriptors.ErrorUtil; public final class DebugTimer { @@ -90,7 +90,7 @@ public boolean equals(Object obj) { abstract static class DebugTimerImpl { abstract void tick(long tick); - abstract void report(TruffleLogger logger, String name); + abstract void report(Consumer logger, String name); abstract void enter(); } @@ -114,11 +114,11 @@ void tick(long tick) { } @Override - void report(TruffleLogger logger, String name) { + void report(Consumer logger, String name) { if (counter.get() == 0) { - logger.info(name + ": " + 0); + logger.accept(name + ": " + 0); } else { - logger.info(name + " total : " + getAsMillis(total()) + " | avg : " + getAsMillis(avg())); + logger.accept(name + " total : " + getAsMillis(total()) + " | avg : " + getAsMillis(avg())); } } diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java index 51a4a2b2520e..f56313dd9086 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollection.java @@ -24,7 +24,7 @@ */ package com.oracle.truffle.espresso.classfile.perf; -import com.oracle.truffle.api.TruffleLogger; +import java.util.function.Consumer; public abstract class TimerCollection { private static final TimerCollection NO_TIMER = new TimerCollectionImpl.NoTimer(); @@ -37,7 +37,7 @@ public static TimerCollection create(boolean enabled) { } } - public abstract void report(TruffleLogger logger); + public abstract void report(Consumer logger); abstract DebugCloseable scope(DebugTimer timer); } diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java index 71d52ab2afc5..48979a1133ec 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/perf/TimerCollectionImpl.java @@ -28,8 +28,7 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; - -import com.oracle.truffle.api.TruffleLogger; +import java.util.function.Consumer; class TimerCollectionImpl extends TimerCollection { private Map mapping = new ConcurrentHashMap<>(); @@ -49,12 +48,12 @@ DebugCloseable scope(DebugTimer timer) { } @Override - public void report(TruffleLogger logger) { + public void report(Consumer logger) { Set visited = new HashSet<>(); report(mapping.keySet(), logger, visited, ""); } - private void report(Iterable timers, TruffleLogger logger, Set visited, String prefix) { + private void report(Iterable timers, Consumer logger, Set visited, String prefix) { for (DebugTimer timer : timers) { if (shouldProcess(visited, timer)) { visited.add(timer); @@ -86,7 +85,7 @@ DebugCloseable scope(DebugTimer timer) { } @Override - public void report(TruffleLogger logger) { + public void report(Consumer logger) { } } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoShutdownHandler.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoShutdownHandler.java index a2f7b274a5be..d1543d858cec 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoShutdownHandler.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoShutdownHandler.java @@ -277,7 +277,7 @@ private void teardown() { } } - getContext().getTimers().report(getContext().getLogger()); + getContext().getTimers().report(getContext().getLogger()::info); } /** From b90383688e390af6908ee4a6abe2f4ceae82268b Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Tue, 11 Mar 2025 17:20:35 +0100 Subject: [PATCH 5/6] Ensure reflection method name at runtime is the expected one. If a hosted method is renamed for the sake of unique names generated in `HostedMethod#create0`, ensure that reflection still uses the original name. --- .../svm/hosted/code/RuntimeMetadataEncoderImpl.java | 4 ++-- .../src/com/oracle/svm/hosted/meta/HostedMethod.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java index 136e5cb39e36..f832425deda2 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java @@ -445,7 +445,7 @@ public void addReflectionFieldMetadata(MetaAccessProvider metaAccess, HostedFiel public void addReflectionExecutableMetadata(MetaAccessProvider metaAccess, HostedMethod hostedMethod, ConditionalRuntimeValue conditionalMethod, Object accessor) { boolean isMethod = !hostedMethod.isConstructor(); HostedType declaringType = hostedMethod.getDeclaringClass(); - String name = isMethod ? hostedMethod.getName() : null; + String name = isMethod ? hostedMethod.getReflectionName() : null; HostedType[] parameterTypes = getParameterTypes(hostedMethod); /* Reflect method because substitution of Object.hashCode() is private */ Executable reflectMethod = conditionalMethod.getValueUnconditionally(); @@ -643,7 +643,7 @@ public void addReachableFieldMetadata(HostedField field) { public void addReachableExecutableMetadata(HostedMethod executable) { boolean isMethod = !executable.isConstructor(); HostedType declaringType = executable.getDeclaringClass(); - String name = isMethod ? executable.getName() : null; + String name = isMethod ? executable.getReflectionName() : null; String[] parameterTypeNames = getParameterTypeNames(executable); /* Fill encoders with the necessary values. */ diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedMethod.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedMethod.java index 536b1832ebc8..42e570bfc9a5 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedMethod.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/HostedMethod.java @@ -398,6 +398,15 @@ public String getName() { return name; } + /** + * Returns the original name of the method, without any suffix that might have been added by + * {@link HostedMethodNameFactory}. + */ + public String getReflectionName() { + VMError.guarantee(this.isOriginalMethod()); + return wrapped.getName(); + } + @Override public ResolvedSignature getSignature() { return signature; From 1448047608c50ff4673777ee16c45ec4483ced93 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Tue, 9 Apr 2024 10:26:32 +0200 Subject: [PATCH 6/6] Introduce ForNameRespectsClassLoader option and use it in Crema * Add class registries for class loaders, add classes at build time based on their defining class loader. * In crema mode add all classes. Without crema, only classes that are configured for runtime reflection are added. * Use as much as possible of the standard class loading code from the JDK as possible. * Add ClassLoading scopes experimental API to allow ignoring the reflection configuration in explicit scopes. * In the crema case, wire class definition to the shared class file parser. * Shade espresso shared code for usage in svm to avoid conflicts with espresso shared code used in application code (e.g., espresso native images) * Add hellocrema command to exercise class loading --- .../mx.espresso-shared/mx_espresso_shared.py | 195 +++++++ espresso-shared/mx.espresso-shared/suite.py | 50 +- .../classfile/descriptors/ByteSequence.java | 25 + .../classfile/descriptors/ModifiedUTF8.java | 16 +- .../classfile/descriptors/Symbols.java | 9 +- .../classfile/descriptors/SymbolsImpl.java | 23 +- espresso/mx.espresso/mx_espresso.py | 11 +- .../nativeimage/impl/ClassLoading.java | 99 ++++ .../nativeimage/impl/ClassLoadingSupport.java | 51 ++ substratevm/CHANGELOG.md | 1 + substratevm/docs/runtime-class-loading.md | 18 + substratevm/mx.substratevm/mx_substratevm.py | 1 + substratevm/mx.substratevm/suite.py | 9 +- .../svm/core/hub/ClassForNameSupport.java | 244 +++++++-- .../com/oracle/svm/core/hub/DynamicHub.java | 57 +- .../core/hub/PredefinedClassesSupport.java | 38 +- .../svm/core/hub/RuntimeClassLoading.java | 200 ++++++- .../core/hub/registry/AOTClassRegistry.java | 61 +++ .../hub/registry/AbstractClassRegistry.java | 98 ++++ .../AbstractRuntimeClassRegistry.java | 515 ++++++++++++++++++ .../core/hub/registry/BootClassRegistry.java | 105 ++++ .../hub/registry/ClassLoadingSupportImpl.java | 67 +++ .../core/hub/registry/ClassRegistries.java | 455 ++++++++++++++++ .../registry/UserDefinedClassRegistry.java | 67 +++ .../svm/core/jdk/JavaLangSubstitutions.java | 16 +- .../svm/core/jdk/SunMiscSubstitutions.java | 14 +- .../jdk/Target_java_lang_ClassLoader.java | 216 ++++++-- ...dk_internal_loader_BuiltinClassLoader.java | 4 + .../core/jdk/proxy/ProxySubstitutions.java | 8 +- .../svm/core/jni/functions/JNIFunctions.java | 8 +- .../svm/hosted/ClassRegistryFeature.java | 72 +++ .../oracle/svm/hosted/ImageClassLoader.java | 13 +- .../hosted/reflect/ReflectionDataBuilder.java | 5 +- .../hosted/snippets/ReflectionPlugins.java | 54 +- .../oracle/svm/interpreter/CremaFeature.java | 2 + 35 files changed, 2629 insertions(+), 198 deletions(-) create mode 100644 espresso-shared/mx.espresso-shared/mx_espresso_shared.py create mode 100644 sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoading.java create mode 100644 sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoadingSupport.java create mode 100644 substratevm/docs/runtime-class-loading.md create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AOTClassRegistry.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractClassRegistry.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractRuntimeClassRegistry.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/BootClassRegistry.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassLoadingSupportImpl.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassRegistries.java create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/UserDefinedClassRegistry.java create mode 100644 substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassRegistryFeature.java diff --git a/espresso-shared/mx.espresso-shared/mx_espresso_shared.py b/espresso-shared/mx.espresso-shared/mx_espresso_shared.py new file mode 100644 index 000000000000..c40d6703e4a1 --- /dev/null +++ b/espresso-shared/mx.espresso-shared/mx_espresso_shared.py @@ -0,0 +1,195 @@ +# +# Copyright (c) 2025, 2025, 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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# 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 os +import re +from collections import OrderedDict +from os.path import join, exists, relpath + +import mx +import mx_util + + +class EspressoSVMShared(mx.JavaProject): + def __init__(self, suite, name, deps, workingSets, theLicense=None, **attr): + self.shadedProjects = attr.pop('shadedProjects') + self.removeAnnotations = attr.pop('removeAnnotations', []) + self.checkPackagePrefix = True + packageMap = attr.pop('packageMap') + self.packageMap = OrderedDict() + for k in sorted(packageMap, key=str.__len__, reverse=True): + self.packageMap[k + '.'] = packageMap[k] + '.' + self.pathMap = OrderedDict((k.replace('.', os.sep), v.replace('.', os.sep)) for k, v in self.packageMap.items()) + javaCompliance = attr.pop('javaCompliance') + super().__init__(suite, name, "", [], deps, javaCompliance, workingSets, suite.dir, theLicense, **attr) + self.gen_src = join(self.get_output_root(), 'gen_src') + self.srcDirs.append(self.gen_src) + + def getBuildTask(self, args): + jdk = mx.get_jdk(self.javaCompliance, tag=mx.DEFAULT_JDK_TAG, purpose='building ' + self.name) + return EspressoSVMSharedBuildTask(args, self, jdk) + + def resolveDeps(self): + super().resolveDeps() + self._resolveDepsHelper(self.shadedProjects) + not_java_projects = [d for d in self.shadedProjects if not d.isJavaProject()] + if not_java_projects: + raise self.abort(f"shadedProjects must all be java projects, but the following are not: {not_java_projects}") + + def get_checkstyle_config(self, resolve_checkstyle_library=True): + return None, None, None + + def shaded_deps(self): + return self.shadedProjects + + def _apply_package_map(self, original, is_path): + map_dict = self.pathMap if is_path else self.packageMap + for k, v in map_dict.items(): + if original.startswith(k): + return v + original[len(k):] + return original + + def substitute_package_name(self, pkg): + return self._apply_package_map(pkg, False) + + def substitute_path(self, path): + return self._apply_package_map(path, True) + + def defined_java_packages(self): + return set([self.substitute_package_name(pkg) for dep in self.shaded_deps() for pkg in dep.defined_java_packages()]) + + +class EspressoSVMSharedBuildTask(mx.JavaBuildTask): + def saved_config_path(self): + return join(self.subject.get_output_root(), 'config') + + def config(self): + config = str(sorted(self.subject.shaded_deps())) + '\n' + config += str(self.subject.javaCompliance) + '\n' + for pkg in sorted(self.subject.packageMap): + config += f"{pkg}: {self.subject.packageMap[pkg]}\n" + config += str(sorted(self.subject.removeAnnotations)) + '\n' + return config + + def _walk_files(self, create_shaded_dirs=False): + for shaded_project in self.subject.shaded_deps(): + for src_dir in shaded_project.source_dirs(): + for dirpath, _, filenames in os.walk(src_dir): + reldirpath = relpath(dirpath, src_dir) + mapped_reldirpath = self.subject.substitute_path(reldirpath) + if create_shaded_dirs and filenames: + mx_util.ensure_dir_exists(join(self.subject.gen_src, mapped_reldirpath)) + for filename in filenames: + shaded_relpath = join(mapped_reldirpath, filename) + yield join(dirpath, filename), join(self.subject.gen_src, shaded_relpath), shaded_relpath + + def needsBuild(self, newestInput): + is_needed, reason = mx.ProjectBuildTask.needsBuild(self, newestInput) + if is_needed: + return True, reason + config_path = self.saved_config_path() + if not exists(config_path): + return True, "Saved config file not found" + config = self.config() + with open(config_path, 'r', encoding='utf-8') as f: + if f.read() != config: + return True, "Configuration changed" + for original, shaded, _ in self._walk_files(): + ts = mx.TimeStampFile(shaded) + if ts.isOlderThan(original): + return True, str(ts) + if newestInput and ts.isOlderThan(newestInput): + return True, str(ts) + return False, None + + def _collect_files(self): + if self._javafiles is not None: + # already collected + return self + javafiles = {} + non_javafiles = {} + output_dir = self.subject.output_dir() + for _, shaded, shaded_relpath in self._walk_files(): + if shaded.endswith('.java'): + classfile = output_dir + shaded_relpath[:-len('.java')] + '.class' + javafiles[shaded] = classfile + else: + non_javafiles[shaded] = output_dir + shaded_relpath + if hasattr(self.subject, 'copyFiles'): + raise mx.abort('copyFiles is not supported', context=self.subject) + self._javafiles = javafiles + self._non_javafiles = non_javafiles + self._copyfiles = {} + return self + + def clean(self, forBuild=False): + super().clean() + if exists(self.subject.gen_src): + mx.rmtree(self.subject.gen_src) + + def build(self): + java_substitutions = [ + sub for orig, shad in self.subject.packageMap.items() for sub in [ + (re.compile(r'\b' + re.escape(orig) + r'(?=\.\w+)?\b'), shad), + ] + ] + re_type_start = re.compile(r"\.[A-Z]") + for annotation_type in self.subject.removeAnnotations: + type_name_start = re_type_start.search(annotation_type).start() + # remove `import com.Foo.Bar;` + # remove `@Foo.Bar(*)` + # remove `@Foo.Bar` + # change `{@link Foo.Bar}` to `{@code Foo.Bar}` + unqualified_type = annotation_type[type_name_start + 1:] + java_substitutions += [ + (re.compile(r'^import\s+' + re.escape(annotation_type) + r'\s*;', re.MULTILINE), ''), + (re.compile(r'@' + re.escape(unqualified_type) + r'(\(.*?\))?'), ''), + (re.compile(r'\{@link ' + re.escape(unqualified_type) + r'\}'), '{@code ' + unqualified_type + '}'), + ] + next_type_name_m = re_type_start.search(annotation_type, type_name_start + 1) + if next_type_name_m: + # remove `import com.Foo;` + # remove `import static com.Foo.Bar;` + # remove `@Bar(*)` + # remove `@Bar` + # change `{@link Bar}` to `{@code Bar}` + next_type_name_start = next_type_name_m.start() + next_unqualified_type = annotation_type[next_type_name_start + 1:] + java_substitutions += [ + (re.compile(r'^import\s+' + re.escape(annotation_type[:next_type_name_start]) + r'\s*;', re.MULTILINE), ''), + (re.compile(r'^import\s+static\s+' + re.escape(annotation_type) + r'\s*;', re.MULTILINE), ''), + (re.compile(r'@' + re.escape(next_unqualified_type) + r'(\(.*?\))?'), ''), + (re.compile(r'\{@link ' + re.escape(next_unqualified_type) + r'\}'), '{@code ' + next_unqualified_type + '}'), + ] + assert not re_type_start.search(annotation_type, next_type_name_start + 1) + + for original, shaded, _ in self._walk_files(True): + with open(original, 'r', encoding='utf-8') as f_orig, open(shaded, 'w', encoding='utf-8') as f_shaded: + for line in f_orig: + for srch, repl in java_substitutions: + line = re.sub(srch, repl, line) + f_shaded.write(line) + super().build() + with open(self.saved_config_path(), 'w', encoding='utf-8') as f: + f.write(self.config()) diff --git a/espresso-shared/mx.espresso-shared/suite.py b/espresso-shared/mx.espresso-shared/suite.py index 9339238cc0dd..e79cdb4e486e 100644 --- a/espresso-shared/mx.espresso-shared/suite.py +++ b/espresso-shared/mx.espresso-shared/suite.py @@ -83,8 +83,6 @@ "sourceDirs": ["src"], "dependencies": [ "sdk:COLLECTIONS", - ], - "buildDependencies": [ "truffle:TRUFFLE_API", ], "javaCompliance" : "17+", @@ -102,6 +100,28 @@ "javaCompliance" : "17+", "checkstyle": "com.oracle.truffle.espresso.classfile", }, + + # Shared code shaded for SVM + "com.oracle.svm.espresso": { + "class": "EspressoSVMShared", + "shadedProjects": [ + "com.oracle.truffle.espresso.classfile", + "com.oracle.truffle.espresso.shared", + ], + "dependencies": [ + "sdk:COLLECTIONS", + ], + "removeAnnotations": [ + "com.oracle.truffle.api.CompilerDirectives.CompilationFinal", + "com.oracle.truffle.api.CompilerDirectives.TruffleBoundary", + "com.oracle.truffle.api.nodes.ExplodeLoop", + ], + "packageMap": { + "com.oracle.truffle.espresso": "com.oracle.svm.espresso", + }, + "eclipseformat": False, + "javaCompliance" : "17+", + }, }, # ------------- distributions @@ -111,15 +131,37 @@ "moduleInfo" : { "name" : "org.graalvm.espresso.shared", "exports": [ - "* to org.graalvm.espresso, org.graalvm.nativeimage.builder", + "* to org.graalvm.espresso", ], }, - "description" : "Shared code runtime class loading", + "description" : "Espresso shared code for runtime class loading", "subDir": "src", "dependencies": [ "com.oracle.truffle.espresso.classfile", "com.oracle.truffle.espresso.shared", ], + "distDependencies": [ + "sdk:COLLECTIONS", + "truffle:TRUFFLE_API", + ], + "maven" : { + "tag": ["default", "public"], + }, + "useModulePath": True, + "noMavenJavadoc": True, + }, + "ESPRESSO_SVM": { + "moduleInfo" : { + "name" : "org.graalvm.espresso.shared.svm", + "exports": [ + "* to org.graalvm.nativeimage.builder", + ], + }, + "description" : "Espresso shared code for runtime class loading (shaded for SVM)", + "subDir": "src", + "dependencies": [ + "com.oracle.svm.espresso", + ], "distDependencies": [ "sdk:COLLECTIONS", ], diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java index da9eaa515921..d808cba86414 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java @@ -88,6 +88,31 @@ public static ByteSequence create(String str) { return ByteSequence.wrap(bytes, 0, bytes.length); } + public static ByteSequence create(String str, int start) { + byte[] bytes = ModifiedUTF8.fromJavaString(str, start, str.length() - start, false); + return ByteSequence.wrap(bytes, 0, bytes.length); + } + + public static ByteSequence createTypeFromName(String str) { + byte[] bytes = ModifiedUTF8.fromJavaString(str, 0, str.length(), false, true); + for (int i = 0; i < bytes.length; i++) { + if (bytes[i] == '.') { + bytes[i] = '/'; + } + } + return ByteSequence.wrap(bytes, 0, bytes.length); + } + + public static ByteSequence createReplacingDot(String str, int start) { + byte[] bytes = ModifiedUTF8.fromJavaString(str, start, str.length() - start, false); + for (int i = 0; i < bytes.length; i++) { + if (bytes[i] == '.') { + bytes[i] = '/'; + } + } + return ByteSequence.wrap(bytes, 0, bytes.length); + } + public static ByteSequence from(ByteBuffer buffer) { int length = buffer.remaining(); if (buffer.hasArray()) { diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java index 7c87f538d5d1..f2c0a4374aba 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java @@ -87,10 +87,17 @@ public static byte[] fromJavaString(String str, boolean append0) { } public static byte[] fromJavaString(String str, int start, int len, boolean append0) { + return fromJavaString(str, start, len, append0, false); + } + + static byte[] fromJavaString(String str, int start, int len, boolean append0, boolean addLSemi) { int utflen = utfLength(str, start, len); - byte[] bytearr = new byte[utflen + (append0 ? 1 : 0)]; // 0 terminated, even if empty. + byte[] bytearr = new byte[utflen + (append0 ? 1 : 0) + (addLSemi ? 2 : 0)]; int count = 0; + if (addLSemi) { + bytearr[count++] = 'L'; + } int i; for (i = 0; i < len; i++) { int c = str.charAt(start + i); @@ -114,10 +121,15 @@ public static byte[] fromJavaString(String str, int start, int len, boolean appe bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } } + if (addLSemi) { + bytearr[count++] = ';'; + } if (append0) { - bytearr[bytearr.length - 1] = (byte) 0; + assert count == bytearr.length - 1; + bytearr[count++] = (byte) 0; } + assert count == bytearr.length; return bytearr; } diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java index 5222f7baef6c..6fb3f94fd1c8 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java @@ -40,11 +40,12 @@ * the table. */ public abstract sealed class Symbols permits SymbolsImpl { - - static final int DEFAULT_CAPACITY = 1 << 12; - public static Symbols fromExisting(Set> existingSymbols, int initialSymbolTable) { - return new SymbolsImpl(existingSymbols, initialSymbolTable); + return fromExisting(existingSymbols, initialSymbolTable, initialSymbolTable); + } + + public static Symbols fromExisting(Set> existingSymbols, int initialStrongSize, int initialWeakSize) { + return new SymbolsImpl(existingSymbols, initialStrongSize, initialWeakSize); } /** diff --git a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java index a44adea4d693..f012eb43cca4 100644 --- a/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java +++ b/espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SymbolsImpl.java @@ -34,23 +34,26 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; final class SymbolsImpl extends Symbols { - // Set generous initial capacity, these are going to be hit a lot. private final ConcurrentHashMap> strongMap; private final WeakHashMap>> weakMap; private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - SymbolsImpl(int initialCapacity) { - this.strongMap = new ConcurrentHashMap<>(initialCapacity); - this.weakMap = new WeakHashMap<>(initialCapacity); - } - - SymbolsImpl() { - this(DEFAULT_CAPACITY); + SymbolsImpl(int initialStrongSize, int initialWeakSize) { + if (initialWeakSize > 0) { + this.strongMap = new ConcurrentHashMap<>(initialStrongSize); + } else { + this.strongMap = new ConcurrentHashMap<>(); + } + if (initialWeakSize > 0) { + this.weakMap = new WeakHashMap<>(initialWeakSize); + } else { + this.weakMap = new WeakHashMap<>(); + } } - SymbolsImpl(Set> existingSymbols, int initialCapacity) { - this(initialCapacity); + SymbolsImpl(Set> existingSymbols, int initialStrongSize, int initialWeakSize) { + this(initialStrongSize, initialWeakSize); for (Symbol symbol : existingSymbols) { this.strongMap.put(symbol, symbol); } diff --git a/espresso/mx.espresso/mx_espresso.py b/espresso/mx.espresso/mx_espresso.py index 9abf8bed8ff4..cb8a86bb31f3 100644 --- a/espresso/mx.espresso/mx_espresso.py +++ b/espresso/mx.espresso/mx_espresso.py @@ -48,7 +48,7 @@ _suite = mx.suite('espresso') # re-export custom mx project classes, so they can be used from suite.py -from mx_sdk_shaded import ShadedLibraryProject +from mx_sdk_shaded import ShadedLibraryProject # pylint: disable=unused-import from mx_sdk_vm_ng import NativeImageLibraryProject, ThinLauncherProject, JavaHomeDependency, DynamicPOMDistribution, ExtractedEngineResources, DeliverableStandaloneArchive, StandaloneLicenses # pylint: disable=unused-import # JDK compiled with the Sulong toolchain. @@ -214,10 +214,12 @@ def _run_verify_imports(s): # Find invalid files invalid_files = [] for project in s.projects: - if isinstance(project, ShadedLibraryProject): - # Ignore shaded libraries - continue + output_root = project.get_output_root() for src_dir in project.source_dirs(): + if src_dir.startswith(output_root): + # ignore source that are under the output root since + # those are probably generated + continue invalid_files += verify_order(src_dir, prefix_order) if invalid_files: @@ -245,6 +247,7 @@ def _espresso_gate_runner(args, tasks): with Task('Espresso: verify import order', tasks, tags=[EspressoTags.imports]) as t: if t: _run_verify_imports(_suite) + _run_verify_imports(mx.suite('espresso-shared')) mokapot_header_gate_name = 'Verify consistency of mokapot headers' with Task(mokapot_header_gate_name, tasks, tags=[EspressoTags.verify]) as t: diff --git a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoading.java b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoading.java new file mode 100644 index 000000000000..d774129c6d93 --- /dev/null +++ b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoading.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package org.graalvm.nativeimage.impl; + +import org.graalvm.nativeimage.ImageInfo; +import org.graalvm.nativeimage.ImageSingletons; + +/** + * Experimental API used to support runtime class loading in the context of native images. + */ +public final class ClassLoading { + private ClassLoading() { + } + + /** + * Checks if runtime class loading is enabled. + */ + public static boolean isSupported() { + if (!ImageInfo.inImageRuntimeCode()) { + return true; + } + return ImageSingletons.lookup(ClassLoadingSupport.class).isSupported(); + } + + /** + * Opens a scope in which class loading is not constrained by the reflection configuration. Once + * the returned {@link AutoCloseable} is closed, the previous state is restored. + * + * @throws IllegalStateException if class loading is not {@linkplain #isSupported() supported}. + */ + public static ArbitraryClassLoadingScope allowArbitraryClassLoading() { + if (!isSupported()) { + throw new IllegalStateException("Runtime class loading is not supported. It must be enabled at build-time with -H:+RuntimeClassLoading."); + } + return new ArbitraryClassLoadingScope(); + } + + public static final class ArbitraryClassLoadingScope implements AutoCloseable { + private boolean closed; + + ArbitraryClassLoadingScope() { + if (!ImageInfo.inImageRuntimeCode()) { + return; + } + ClassLoadingSupport support = ImageSingletons.lookup(ClassLoadingSupport.class); + support.startIgnoreReflectionConfigurationScope(); + } + + @Override + public void close() { + if (closed) { + throw new IllegalStateException("ArbitraryClassLoadingScope is already closed"); + } + closed = true; + if (!ImageInfo.inImageRuntimeCode()) { + return; + } + ImageSingletons.lookup(ClassLoadingSupport.class).endIgnoreReflectionConfigurationScope(); + } + } +} diff --git a/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoadingSupport.java b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoadingSupport.java new file mode 100644 index 000000000000..9469b5c89e68 --- /dev/null +++ b/sdk/src/org.graalvm.nativeimage/src/org/graalvm/nativeimage/impl/ClassLoadingSupport.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * The Universal Permissive License (UPL), Version 1.0 + * + * Subject to the condition set forth below, permission is hereby granted to any + * person obtaining a copy of this software, associated documentation and/or + * data (collectively the "Software"), free of charge and under any and all + * copyright rights in the Software, and any and all patent rights owned or + * freely licensable by each licensor hereunder covering either (i) the + * unmodified Software as contributed to or provided by such licensor, or (ii) + * the Larger Works (as defined below), to deal in both + * + * (a) the Software, and + * + * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if + * one is included with the Software each a "Larger Work" to which the Software + * is contributed by such licensors), + * + * without restriction, including without limitation the rights to copy, create + * derivative works of, display, perform, and distribute the Software and make, + * use, sell, offer for sale, import, export, have made, and have sold the + * Software and the Larger Work(s), and to sublicense the foregoing rights on + * either these or other terms. + * + * This license is subject to the following condition: + * + * The above copyright notice and either this complete permission notice or at a + * minimum a reference to the UPL must be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package org.graalvm.nativeimage.impl; + +public interface ClassLoadingSupport { + boolean isSupported(); + + boolean followReflectionConfiguration(); + + void startIgnoreReflectionConfigurationScope(); + + void endIgnoreReflectionConfigurationScope(); +} diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index 1885bc3f30e5..336c55941b15 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -20,6 +20,7 @@ This changelog summarizes major changes to GraalVM Native Image. * (GR-64584) Experimental option `-H:+RelativeCodePointers` to significantly reduce relocation entries in position-independent executables and shared libraries. * (GR-60238) JNI registration is now included as part of the `"reflection"` section of _reachability-metadata.json_ using the `"jniAccessible"` attribute. Registrations performed through the `"jni"` section of _reachability-metadata.json_ and through _jni-config.json_ will still be accepted and parsed correctly. * (GR-65008) Remove the sequential reachability handler. The only remaining variant is the concurrent reachability handler, which has been the default implementation since its introduction. Additionally, remove the `-H:-RunReachabilityHandlersConcurrently` option which was introduced to simplify migration and has been deprecated since Version 24.0.0. +* (GR-53985) Add experimental option `ClassForNameRespectsClassLoader` that makes `Class.forName(...)` respect the class loader hierarchy. ## GraalVM for JDK 24 (Internal Version 24.2.0) * (GR-59717) Added `DuringSetupAccess.registerObjectReachabilityHandler` to allow registering a callback that is executed when an object of a specified type is marked as reachable during heap scanning. diff --git a/substratevm/docs/runtime-class-loading.md b/substratevm/docs/runtime-class-loading.md new file mode 100644 index 000000000000..aebaaf920dd6 --- /dev/null +++ b/substratevm/docs/runtime-class-loading.md @@ -0,0 +1,18 @@ +# Runtime Class Loading + +Runtime class loading lets `ClassLoader.defineClass` work at runtime, creating new `DynamicHub`s. + +## Requirements + +It requires: +* `ClosedTypeWorld` to be disabled since we are adding new types +* `ClassForNameRespectsClassLoader` to be enabled for the classloader mechanisms to work and reach `defineClass` +* `SupportPredefinedClasses` to be disabled as a simplification to avoid having to worry about the intersection of those features + +## Status + +At the moment it only supports loading some trivial classes with no fields or methods. +Inner classes and classes that are part of a nest are not supported. + +Parallel class loading is explicitly disabled and not supported at the moment. + diff --git a/substratevm/mx.substratevm/mx_substratevm.py b/substratevm/mx.substratevm/mx_substratevm.py index 92339d10aee4..dfe2c6de4992 100644 --- a/substratevm/mx.substratevm/mx_substratevm.py +++ b/substratevm/mx.substratevm/mx_substratevm.py @@ -1233,6 +1233,7 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing builder_jar_distributions=[ 'substratevm:SVM', 'substratevm:SVM_CONFIGURE', + 'espresso-shared:ESPRESSO_SVM', 'substratevm:OBJECTFILE', 'substratevm:POINTSTO', 'substratevm:SVM_CAPNPROTO_RUNTIME', diff --git a/substratevm/mx.substratevm/suite.py b/substratevm/mx.substratevm/suite.py index 3d9609bb3da5..ac4ae890b6fb 100644 --- a/substratevm/mx.substratevm/suite.py +++ b/substratevm/mx.substratevm/suite.py @@ -31,6 +31,10 @@ "name": "compiler", "subdir": True, }, + { + "name": "espresso-shared", + "subdir": True, + }, ] }, @@ -337,6 +341,7 @@ "com.oracle.svm.common", "com.oracle.svm.shaded.org.objectweb.asm", "SVM_CONFIGURE", + "espresso-shared:ESPRESSO_SVM", ], "requires" : [ "java.compiler", @@ -1726,6 +1731,7 @@ "compiler:GRAAL", "NATIVE_IMAGE_BASE", "SVM_CONFIGURE", + "espresso-shared:ESPRESSO_SVM", ], "moduleInfo" : { "name" : "org.graalvm.nativeimage.builder", @@ -1776,7 +1782,8 @@ "org.graalvm.collections", "org.graalvm.truffle.compiler", "org.graalvm.nativeimage.configure", - "org.graalvm.nativeimage.libgraal" + "org.graalvm.nativeimage.libgraal", + "org.graalvm.espresso.shared.svm", ], "uses" : [ "org.graalvm.nativeimage.Platform", diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java index c5efadad75ae..9e9412a89171 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/ClassForNameSupport.java @@ -25,10 +25,12 @@ package com.oracle.svm.core.hub; import static com.oracle.svm.core.MissingRegistrationUtils.throwMissingRegistrationErrors; +import static jdk.graal.compiler.options.OptionStability.EXPERIMENTAL; import java.lang.reflect.Modifier; import java.util.EnumSet; import java.util.Objects; +import java.util.function.BooleanSupplier; import org.graalvm.collections.EconomicMap; import org.graalvm.nativeimage.Platform; @@ -40,17 +42,42 @@ import com.oracle.svm.core.configure.ConditionalRuntimeValue; import com.oracle.svm.core.configure.RuntimeConditionSet; import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton; +import com.oracle.svm.core.hub.registry.ClassRegistries; import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonBuilderFlags; import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonSupport; import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton; import com.oracle.svm.core.layeredimagesingleton.UnsavedSingleton; +import com.oracle.svm.core.option.HostedOptionKey; import com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils; import com.oracle.svm.core.util.ImageHeapMap; import com.oracle.svm.core.util.VMError; +import jdk.graal.compiler.options.Option; + @AutomaticallyRegisteredImageSingleton public final class ClassForNameSupport implements MultiLayeredImageSingleton, UnsavedSingleton { + public static final class Options { + @Option(help = "Class.forName and similar respect their class loader argument.", stability = EXPERIMENTAL)// + public static final HostedOptionKey ClassForNameRespectsClassLoader = new HostedOptionKey<>(false); + } + + @Platforms(Platform.HOSTED_ONLY.class) + public static final class RespectsClassLoader implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + return respectClassLoader(); + } + } + + @Platforms(Platform.HOSTED_ONLY.class) + public static final class IgnoresClassLoader implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + return !respectClassLoader(); + } + } + private ClassLoader libGraalLoader; public void setLibGraalLoader(ClassLoader libGraalLoader) { @@ -67,64 +94,103 @@ private static ClassForNameSupport[] layeredSingletons() { } /** - * The map used to collect registered classes. + * The map used to collect registered classes. Not used when respecting class loaders. + */ + private final EconomicMap> knownClasses; + /** + * The map used to collect registered class names. When respecting class loaders this replaces + * knownClasses. */ - private final EconomicMap> knownClasses = ImageHeapMap.createNonLayeredMap(); + private final EconomicMap knownClassNames; + /** + * The map used to collect exceptions that should be thrown by Class.forName. Only used when + * respecting class loaders. + */ + private final EconomicMap knownExceptions; /** * The map used to collect unsafe allocated classes. */ - private final EconomicMap, RuntimeConditionSet> unsafeInstantiatedClasses = ImageHeapMap.createNonLayeredMap(); + private final EconomicMap, RuntimeConditionSet> unsafeInstantiatedClasses; private static final Object NEGATIVE_QUERY = new Object(); + public ClassForNameSupport() { + if (respectClassLoader()) { + knownClasses = null; + knownClassNames = ImageHeapMap.createNonLayeredMap(); + knownExceptions = ImageHeapMap.createNonLayeredMap(); + } else { + knownClasses = ImageHeapMap.createNonLayeredMap(); + knownClassNames = null; + knownExceptions = null; + } + unsafeInstantiatedClasses = ImageHeapMap.createNonLayeredMap(); + } + + public static boolean respectClassLoader() { + return Options.ClassForNameRespectsClassLoader.getValue(); + } + @Platforms(Platform.HOSTED_ONLY.class) - public void registerClass(Class clazz) { - registerClass(ConfigurationCondition.alwaysTrue(), clazz); + public void registerClass(Class clazz, ClassLoader runtimeClassLoader) { + registerClass(ConfigurationCondition.alwaysTrue(), clazz, runtimeClassLoader); } @Platforms(Platform.HOSTED_ONLY.class) - public void registerClass(ConfigurationCondition condition, Class clazz) { + public void registerClass(ConfigurationCondition condition, Class clazz, ClassLoader runtimeClassLoader) { assert !clazz.isPrimitive() : "primitive classes cannot be looked up by name"; if (PredefinedClassesSupport.isPredefined(clazz)) { return; // must be defined at runtime before it can be looked up } - synchronized (knownClasses) { - String name = clazz.getName(); - ConditionalRuntimeValue exisingEntry = knownClasses.get(name); - Object currentValue = exisingEntry == null ? null : exisingEntry.getValueUnconditionally(); - - /* TODO: Remove workaround once GR-53985 is implemented */ - if (currentValue instanceof Class currentClazz && clazz.getClassLoader() != currentClazz.getClassLoader()) { - /* Ensure runtime lookup of LibGraalClassLoader classes */ - if (isLibGraalClass(currentClazz)) { - return; - } - if (isLibGraalClass(clazz)) { - currentValue = null; - } + String name = clazz.getName(); + if (respectClassLoader()) { + registerKnownClassName(condition, name); + Class elemental = clazz; + while (elemental.isArray()) { + elemental = elemental.getComponentType(); } + if (!elemental.isPrimitive()) { + ClassRegistries.addAOTClass(runtimeClassLoader, elemental); + } + } else { + synchronized (knownClasses) { + ConditionalRuntimeValue existingEntry = knownClasses.get(name); + Object currentValue = existingEntry == null ? null : existingEntry.getValueUnconditionally(); - if (currentValue == null || // never seen - currentValue == NEGATIVE_QUERY || - currentValue == clazz) { - currentValue = clazz; - var cond = updateConditionalValue(exisingEntry, currentValue, condition); - knownClasses.put(name, cond); - } else if (currentValue instanceof Throwable) { // failed at linking time - var cond = updateConditionalValue(exisingEntry, currentValue, condition); - /* - * If the class has already been seen as throwing an error, we don't overwrite this - * error. Nevertheless, we have to update the set of conditionals to be correct. - */ - knownClasses.put(name, cond); - } else { - throw VMError.shouldNotReachHere(""" - Invalid Class.forName value for %s: %s - If the class is already registered as negative, it means that it exists but is not - accessible through the builder class loader, and it was already registered by name (as - negative query) before this point. In that case, we update the map to contain the actual - class. - """, name, currentValue); + /* TODO: Remove workaround once GR-53985 is implemented */ + if (currentValue instanceof Class currentClazz && clazz.getClassLoader() != currentClazz.getClassLoader()) { + /* Ensure runtime lookup of LibGraalClassLoader classes */ + if (isLibGraalClass(currentClazz)) { + return; + } + if (isLibGraalClass(clazz)) { + currentValue = null; + } + } + + if (currentValue == null || // never seen + currentValue == NEGATIVE_QUERY || + currentValue == clazz) { + currentValue = clazz; + var cond = updateConditionalValue(existingEntry, currentValue, condition); + knownClasses.put(name, cond); + } else if (currentValue instanceof Throwable) { // failed at linking time + var cond = updateConditionalValue(existingEntry, currentValue, condition); + /* + * If the class has already been seen as throwing an error, we don't overwrite + * this error. Nevertheless, we have to update the set of conditionals to be + * correct. + */ + knownClasses.put(name, cond); + } else { + throw VMError.shouldNotReachHere(""" + Invalid Class.forName value for %s: %s + If the class is already registered as negative, it means that it exists but is not + accessible through the builder class loader, and it was already registered by name (as + negative query) before this point. In that case, we update the map to contain the actual + class. + """, name, currentValue); + } } } } @@ -147,16 +213,43 @@ public static ConditionalRuntimeValue updateConditionalValue(Conditional @Platforms(Platform.HOSTED_ONLY.class) public void registerExceptionForClass(ConfigurationCondition condition, String className, Throwable t) { - updateCondition(condition, className, t); + if (RuntimeClassLoading.isSupported()) { + return; + } + if (respectClassLoader()) { + registerKnownClassName(condition, className); + synchronized (knownExceptions) { + knownExceptions.put(className, t); + } + } else { + updateCondition(condition, className, t); + } } @Platforms(Platform.HOSTED_ONLY.class) public void registerNegativeQuery(ConfigurationCondition condition, String className) { - /* - * If the class is not accessible by the builder class loader, but was already registered - * through registerClass(Class), we don't overwrite the actual class or exception. - */ - updateCondition(condition, className, NEGATIVE_QUERY); + if (respectClassLoader()) { + registerKnownClassName(condition, className); + } else { + /* + * If the class is not accessible by the builder class loader, but was already + * registered through registerClass(Class), we don't overwrite the actual class or + * exception. + */ + updateCondition(condition, className, NEGATIVE_QUERY); + } + } + + private void registerKnownClassName(ConfigurationCondition condition, String className) { + assert respectClassLoader(); + synchronized (knownClassNames) { + RuntimeConditionSet existingConditions = knownClassNames.get(className); + if (existingConditions == null) { + knownClassNames.put(className, RuntimeConditionSet.createHosted(condition)); + } else { + existingConditions.addCondition(condition); + } + } } @Platforms(Platform.HOSTED_ONLY.class) @@ -263,12 +356,23 @@ private Object forName0(String className, ClassLoader classLoader) { } public int count() { - return knownClasses.size(); + if (respectClassLoader()) { + return knownClassNames.size(); + } else { + return knownClasses.size(); + } } public static RuntimeConditionSet getConditionFor(Class jClass) { Objects.requireNonNull(jClass); String jClassName = jClass.getName(); + if (respectClassLoader()) { + RuntimeConditionSet conditionSet = getConditionForName(jClassName); + if (conditionSet == null) { + return RuntimeConditionSet.unmodifiableEmptySet(); + } + return conditionSet; + } ConditionalRuntimeValue conditionalClass = null; for (var singleton : layeredSingletons()) { conditionalClass = singleton.knownClasses.get(jClassName); @@ -283,6 +387,50 @@ public static RuntimeConditionSet getConditionFor(Class jClass) { } } + public static boolean isRegisteredClass(String className) { + assert respectClassLoader(); + RuntimeConditionSet conditionSet = getConditionForName(className); + if (conditionSet == null) { + return false; + } + return conditionSet.satisfied(); + } + + @Platforms(Platform.HOSTED_ONLY.class) + public static boolean isCurrentLayerRegisteredClass(String className) { + assert respectClassLoader(); + RuntimeConditionSet conditionSet = currentLayer().knownClassNames.get(className); + if (conditionSet == null) { + return false; + } + return conditionSet.satisfied(); + } + + private static RuntimeConditionSet getConditionForName(String className) { + for (var singleton : layeredSingletons()) { + RuntimeConditionSet conditionSet = singleton.knownClassNames.get(className); + if (conditionSet != null) { + return conditionSet; + } + } + return null; + } + + public static Throwable getSavedException(String className) { + assert respectClassLoader() && !RuntimeClassLoading.isSupported(); + if (!isRegisteredClass(className)) { + return null; + } + Throwable exception = null; + for (var singleton : layeredSingletons()) { + exception = singleton.knownExceptions.get(className); + if (exception != null) { + break; + } + } + return exception; + } + /** * Checks whether {@code hub} can be instantiated with {@code Unsafe.allocateInstance}. Note * that arrays can't be instantiated and this function will always return false for array types. diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java index 219cc7ef0811..f0061b6c3e67 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java @@ -105,6 +105,7 @@ import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.classinitialization.ClassInitializationInfo; import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode; import com.oracle.svm.core.config.ConfigurationValues; @@ -114,6 +115,7 @@ import com.oracle.svm.core.graal.nodes.SubstrateNewDynamicHubNode; import com.oracle.svm.core.heap.UnknownObjectField; import com.oracle.svm.core.heap.UnknownPrimitiveField; +import com.oracle.svm.core.hub.registry.ClassRegistries; import com.oracle.svm.core.imagelayer.DynamicImageLayerInfo; import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport; import com.oracle.svm.core.jdk.ProtectionDomainSupport; @@ -127,6 +129,7 @@ import com.oracle.svm.core.reflect.fieldaccessor.UnsafeFieldAccessorFactory; import com.oracle.svm.core.reflect.serialize.SerializationSupport; import com.oracle.svm.core.reflect.target.Target_jdk_internal_reflect_ConstantPool; +import com.oracle.svm.core.util.BasedOnJDKFile; import com.oracle.svm.core.util.LazyFinalReference; import com.oracle.svm.core.util.VMError; import com.oracle.svm.util.ReflectionUtil; @@ -423,7 +426,7 @@ public DynamicHub(Class hostedJavaClass, String name, byte hubType, Reference * {@code DynamicHub} must be fully initialized when it is used in an object header. */ @NeverInline("Fields of DynamicHub are immutable. Immutable reads could float above ANY_LOCATION writes.") - public static DynamicHub allocate(String name, DynamicHub superHub, DynamicHub componentHub, String sourceFileName, + public static DynamicHub allocate(String name, DynamicHub superHub, Object interfacesEncoding, DynamicHub componentHub, String sourceFileName, int modifiers, short flags, ClassLoader classLoader, Class nestHost, String simpleBinaryName, Object declaringClass, String signature) { VMError.guarantee(RuntimeClassLoading.isSupported()); @@ -435,7 +438,7 @@ public static DynamicHub allocate(String name, DynamicHub superHub, DynamicHub c hubType = HubType.REFERENCE_INSTANCE; } - // GR-59683 + // GR-62339 Module module = null; // GR-59683: Setup interpreter metadata at run-time. @@ -463,8 +466,8 @@ public static DynamicHub allocate(String name, DynamicHub superHub, DynamicHub c short numInterfacesTypes = 0; int[] openTypeWorldTypeCheckSlots = new int[numClassTypes + (numInterfacesTypes * 2)]; - // GR-59683: Proper values needed. - companion.interfacesEncoding = null; + companion.interfacesEncoding = interfacesEncoding; + // GR-59683: Proper value needed. companion.enumConstantsReference = null; /* @@ -1590,24 +1593,42 @@ private static Constructor[] copyConstructors(Constructor[] original) { @Substitute @NeverInlineTrivial(reason = "Used in dynamic access call usage analysis: DynamicAccessDetectionPhase", onlyWith = TrackDynamicAccessEnabled.class) @CallerSensitive + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class forName(String className) throws Throwable { return forName(className, Reflection.getCallerClass()); } + @KeepOriginal + @CallerSensitive + @TargetElement(name = "forName", onlyWith = ClassForNameSupport.RespectsClassLoader.class) + private static native Class forNameOriginal(String className) throws ClassNotFoundException; + @Substitute @NeverInlineTrivial(reason = "Used in dynamic access call usage analysis: DynamicAccessDetectionPhase", onlyWith = TrackDynamicAccessEnabled.class) @CallerSensitiveAdapter + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class forName(String className, Class caller) throws Throwable { return forName(className, true, caller == null ? ClassLoader.getSystemClassLoader() : caller.getClassLoader(), caller); } + @KeepOriginal + @CallerSensitiveAdapter + @TargetElement(name = "forName", onlyWith = ClassForNameSupport.RespectsClassLoader.class) + private static native Class forNameOriginal(String className, Class caller) throws ClassNotFoundException; + @Substitute @NeverInlineTrivial(reason = "Used in dynamic access call usage analysis: DynamicAccessDetectionPhase", onlyWith = TrackDynamicAccessEnabled.class) @CallerSensitive + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class forName(Module module, String className) throws Throwable { return forName(module, className, Reflection.getCallerClass()); } + @KeepOriginal + @CallerSensitive + @TargetElement(name = "forName", onlyWith = ClassForNameSupport.RespectsClassLoader.class) + private static native Class forNameOriginal(Module module, String className); + @CallerSensitiveAdapter private static Class forName(@SuppressWarnings("unused") Module module, String className, Class caller) throws Throwable { /* @@ -1624,10 +1645,16 @@ private static Class forName(@SuppressWarnings("unused") Module module, Strin @Substitute @NeverInlineTrivial(reason = "Used in dynamic access call usage analysis: DynamicAccessDetectionPhase", onlyWith = TrackDynamicAccessEnabled.class) @CallerSensitive + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class forName(String name, boolean initialize, ClassLoader loader) throws Throwable { return forName(name, initialize, loader, Reflection.getCallerClass()); } + @KeepOriginal + @CallerSensitive + @TargetElement(name = "forName", onlyWith = ClassForNameSupport.RespectsClassLoader.class) + private static native Class forNameOriginal(String name, boolean initialize, ClassLoader loader); + @CallerSensitiveAdapter private static Class forName(String name, boolean initialize, ClassLoader loader, @SuppressWarnings("unused") Class caller) throws Throwable { if (name == null) { @@ -1649,6 +1676,24 @@ private static Class forName(String name, boolean initialize, ClassLoader loa return result; } + @Substitute + @CallerSensitiveAdapter + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class) + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/Class.c#L97-L144") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L803-L821") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L3303-L3312") + private static Class forName0(String name, boolean initialize, ClassLoader loader, @SuppressWarnings("unused") Class caller) throws ClassNotFoundException { + // this accepts dot-names and arrays types (`[...`), it refuses slash-names + if (name.contains("/")) { + throw new ClassNotFoundException(name); + } + Class result = ClassRegistries.forName(name, loader); + if (initialize) { + DynamicHub.fromClass(result).ensureInitialized(); + } + return result; + } + @KeepOriginal public static native Class forPrimitiveName(String primitiveName); @@ -2132,6 +2177,10 @@ public boolean isReached() { return companion.classInitializationInfo.isTypeReached(this); } + public boolean isRuntimeLoaded() { + return RuntimeClassLoading.isSupported() && getLayerId() == DynamicImageLayerInfo.CREMA_LAYER_ID; + } + private static final class ReflectionDataAccessors { @SuppressWarnings("unused") private static SoftReference> getReflectionData(DynamicHub that) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/PredefinedClassesSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/PredefinedClassesSupport.java index df2c91eddaf7..f0952f77b7d6 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/PredefinedClassesSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/PredefinedClassesSupport.java @@ -80,24 +80,6 @@ public static boolean hasBytecodeClasses() { return supportsBytecodes() && !singleton().predefinedClassesByHash.isEmpty(); } - private static final String DEFINITION_NOT_SUPPORTED_MESSAGE = """ - To make this work, you have the following options: - 1) Modify or reconfigure your application (or a third-party library) so that it does not generate classes at runtime or load them via non-built-in class loaders. - 2) If the classes must be generated, try to generate them at build time in a static initializer of a dedicated class.\ - The generated java.lang.Class objects should be stored in static fields and the dedicated class initialized by passing '--initialize-at-build-time=' as the build argument. - 3) If none of the above is applicable, use the tracing agent to run this application and collect predefined classes with\ - 'java -agentlib:native-image-agent=config-output-dir=,experimental-class-define-support '.\ - Note that this is an experimental feature and that it does not guarantee success. Furthermore, the resulting classes can contain entries\ - from the classpath that should be manually filtered out to reduce image size. The agent should be used only in cases where modifying the source of the project is not possible. - """ - .replace("\n", System.lineSeparator()); - - public static RuntimeException throwNoBytecodeClasses(String className) { - assert !hasBytecodeClasses(); - throw VMError.unsupportedFeature("Classes cannot be defined at runtime when using ahead-of-time Native Image compilation. Tried to define class '" + className + "'" + System.lineSeparator() + - DEFINITION_NOT_SUPPORTED_MESSAGE); - } - @Fold static PredefinedClassesSupport singleton() { return ImageSingletons.lookup(PredefinedClassesSupport.class); @@ -189,24 +171,16 @@ public static boolean isPredefined(Class clazz) { return singleton().predefinedClasses.contains(clazz); } - public static Class loadClass(ClassLoader classLoader, String expectedName, byte[] data, int offset, int length, ProtectionDomain protectionDomain) { - if (!hasBytecodeClasses()) { - throw throwNoBytecodeClasses(expectedName); - } - String hash = Digest.digest(data, offset, length); + public static Class knownClass(byte[] data, int offset, int length) { + String hash = getHash(data, offset, length); Class clazz = singleton().predefinedClassesByHash.get(hash); - if (clazz == null) { - String name = (expectedName != null) ? expectedName : "(name not specified)"; - throw VMError.unsupportedFeature( - "Class " + name + " with hash " + hash + " was not provided during the image build via the 'predefined-classes-config.json' file. Please see 'BuildConfiguration.md'."); - } - if (expectedName != null && !expectedName.equals(clazz.getName())) { - throw new NoClassDefFoundError(clazz.getName() + " (wrong name: " + expectedName + ')'); - } - loadClass(classLoader, protectionDomain, clazz); return clazz; } + public static String getHash(byte[] data, int offset, int length) { + return Digest.digest(data, offset, length); + } + public static void loadClass(ClassLoader classLoader, ProtectionDomain protectionDomain, Class clazz) { boolean loaded = loadClassIfNotLoaded(classLoader, protectionDomain, clazz); if (!loaded) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/RuntimeClassLoading.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/RuntimeClassLoading.java index f1cc490a6ebf..c27b665e952a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/RuntimeClassLoading.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/RuntimeClassLoading.java @@ -26,13 +26,19 @@ import static jdk.graal.compiler.options.OptionStability.EXPERIMENTAL; +import java.security.ProtectionDomain; + import org.graalvm.collections.EconomicMap; import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.impl.ClassLoadingSupport; import com.oracle.svm.core.SubstrateOptions; +import com.oracle.svm.core.hub.registry.ClassRegistries; import com.oracle.svm.core.option.HostedOptionKey; import com.oracle.svm.core.option.SubstrateOptionsParser; import com.oracle.svm.core.util.UserError; +import com.oracle.svm.core.util.VMError; +import com.oracle.svm.espresso.classfile.Constants; import jdk.graal.compiler.api.replacements.Fold; import jdk.graal.compiler.options.Option; @@ -40,9 +46,33 @@ import jdk.vm.ci.meta.ResolvedJavaType; public class RuntimeClassLoading { + public enum VerifyMode { + /** + * Disables bytecode verification for all class loaders. + */ + NONE, + /** + * Disables bytecode verification for the boot class loader. Classes loaded for any other + * loader are still verified. This is usually the default mode. + */ + REMOTE, + /** + * Enables bytecode verification for all class loaders. + */ + ALL; + + public boolean needsVerification(ClassLoader loader) { + return switch (this) { + case NONE -> false; + case REMOTE -> loader != null; + case ALL -> true; + }; + } + } + public static final class Options { - @Option(help = "Enable support for runtime class loading.", stability = EXPERIMENTAL) // - public static final HostedOptionKey SupportRuntimeClassLoading = new HostedOptionKey<>(false, Options::validate) { + @Option(help = "Enable support for runtime class loading. This implies open world (-ClosedTypeWorld) and respecting class loader hierarchy (+ClassForNameRespectsClassLoader).", stability = EXPERIMENTAL) // + public static final HostedOptionKey RuntimeClassLoading = new HostedOptionKey<>(false, Options::validateRuntimeClassLoading) { @Override protected void onValueUpdate(EconomicMap, Object> values, Boolean oldValue, Boolean newValue) { @@ -50,21 +80,179 @@ protected void onValueUpdate(EconomicMap, Object> values, Boolean o if (newValue) { /* requires open type world */ SubstrateOptions.ClosedTypeWorld.update(values, false); + ClassForNameSupport.Options.ClassForNameRespectsClassLoader.update(values, true); + PredefinedClassesSupport.Options.SupportPredefinedClasses.update(values, false); } } }; - private static void validate(HostedOptionKey optionKey) { - if (optionKey.hasBeenSet() && optionKey.getValue() && SubstrateOptions.ClosedTypeWorld.getValue()) { - throw UserError.invalidOptionValue(SupportRuntimeClassLoading, SupportRuntimeClassLoading.getValue(), + private static void validateRuntimeClassLoading(HostedOptionKey optionKey) { + if (!optionKey.getValue()) { + return; + } + if (SubstrateOptions.ClosedTypeWorld.getValue()) { + throw UserError.invalidOptionValue(RuntimeClassLoading, RuntimeClassLoading.getValue(), "Requires an open type world, Please use " + SubstrateOptionsParser.commandArgument(SubstrateOptions.ClosedTypeWorld, "-")); } + if (!ClassForNameSupport.Options.ClassForNameRespectsClassLoader.getValue()) { + throw UserError.invalidOptionValue(RuntimeClassLoading, RuntimeClassLoading.getValue(), + "Requires Class.forName to respect the classloader argument, Please use " + + SubstrateOptionsParser.commandArgument(ClassForNameSupport.Options.ClassForNameRespectsClassLoader, "+")); + } + if (PredefinedClassesSupport.Options.SupportPredefinedClasses.getValue()) { + throw UserError.invalidOptionValue(RuntimeClassLoading, RuntimeClassLoading.getValue(), + "Requires predefined class support to be disabled, Please use " + + SubstrateOptionsParser.commandArgument(PredefinedClassesSupport.Options.SupportPredefinedClasses, "-")); + } } + + @Option(help = "Verification mode for runtime class loading.") // + public static final HostedOptionKey ClassVerification = new HostedOptionKey<>(VerifyMode.REMOTE); } @Fold public static boolean isSupported() { - return Options.SupportRuntimeClassLoading.getValue(); + return Options.RuntimeClassLoading.getValue(); + } + + public static boolean followReflectionConfiguration() { + return ImageSingletons.lookup(ClassLoadingSupport.class).followReflectionConfiguration(); + } + + public static Class defineClass(ClassLoader loader, String expectedName, byte[] b, int off, int len, ClassDefinitionInfo info) { + if (PredefinedClassesSupport.hasBytecodeClasses()) { + Class knownClass = PredefinedClassesSupport.knownClass(b, off, len); + if (knownClass != null) { + if (expectedName != null) { + String dotName = expectedName.replace('/', '.'); + if (!dotName.equals(knownClass.getName())) { + throw new NoClassDefFoundError(knownClass.getName() + " (wrong name: " + dotName + ')'); + } + } + PredefinedClassesSupport.loadClass(loader, info.protectionDomain, knownClass); + return knownClass; + } + String name = (expectedName != null) ? expectedName : "(name not specified)"; + throw VMError.unsupportedFeature( + "Class " + name + " with hash " + PredefinedClassesSupport.getHash(b, off, len) + + " was not provided during the image build via the 'predefined-classes-config.json' file. Please see 'BuildConfiguration.md'."); + } else if (RuntimeClassLoading.isSupported()) { + return ClassRegistries.defineClass(loader, expectedName, b, off, len, info); + } else { + throw throwNoBytecodeClasses(expectedName); + } + } + + // This should also mention Crema when it can load non-trivial classes (GR-60118) + private static final String DEFINITION_NOT_SUPPORTED_MESSAGE = """ + To make this work, you have the following options: + 1) Modify or reconfigure your application (or a third-party library) so that it does not generate classes at runtime or load them via non-built-in class loaders. + 2) If the classes must be generated, try to generate them at build time in a static initializer of a dedicated class.\ + The generated java.lang.Class objects should be stored in static fields and the dedicated class initialized by passing '--initialize-at-build-time=' as the build argument. + 3) If none of the above is applicable, use the tracing agent to run this application and collect predefined classes with\ + 'java -agentlib:native-image-agent=config-output-dir=,experimental-class-define-support '.\ + Note that this is an experimental feature and that it does not guarantee success. Furthermore, the resulting classes can contain entries\ + from the classpath that should be manually filtered out to reduce image size. The agent should be used only in cases where modifying the source of the project is not possible. + """ + .replace("\n", System.lineSeparator()); + + public static RuntimeException throwNoBytecodeClasses(String className) { + assert !PredefinedClassesSupport.hasBytecodeClasses() && !RuntimeClassLoading.isSupported(); + throw VMError.unsupportedFeature( + "Classes cannot be defined at runtime by default when using ahead-of-time Native Image compilation. Tried to define class '" + className + "'" + System.lineSeparator() + + DEFINITION_NOT_SUPPORTED_MESSAGE); + } + + public static DynamicHub getOrCreateArrayHub(DynamicHub hub) { + if (hub.getArrayHub() == null) { + VMError.guarantee(RuntimeClassLoading.isSupported()); + // GR-63452 + throw VMError.unimplemented("array hub creation"); + } + return hub.getArrayHub(); + } + + public static final class ClassDefinitionInfo { + public static final ClassDefinitionInfo EMPTY = new ClassDefinitionInfo(null, null, null, false, false, false); + + // Constructor for regular definition, but with a specified protection domain + public ClassDefinitionInfo(ProtectionDomain protectionDomain) { + this(protectionDomain, null, null, false, false, false); + } + + // Constructor for Hidden class definition. + public ClassDefinitionInfo(ProtectionDomain protectionDomain, Class dynamicNest, Object classData, boolean isStrongHidden, boolean forceAllowVMAnnotations) { + this(protectionDomain, dynamicNest, classData, true, isStrongHidden, forceAllowVMAnnotations); + } + + private ClassDefinitionInfo(ProtectionDomain protectionDomain, + Class dynamicNest, + Object classData, + boolean isHidden, + boolean isStrongHidden, + boolean forceAllowVMAnnotations) { + assert !isStrongHidden || isHidden; + assert dynamicNest == null || isHidden; + assert classData == null || isHidden; + assert !forceAllowVMAnnotations || isHidden; + this.protectionDomain = protectionDomain; + this.dynamicNest = dynamicNest; + this.classData = classData; + this.isHidden = isHidden; + this.isStrongHidden = isStrongHidden; + this.forceAllowVMAnnotations = forceAllowVMAnnotations; + } + + public final ProtectionDomain protectionDomain; + + // Hidden class + public final Class dynamicNest; + public final Object classData; + public final boolean isHidden; + public final boolean isStrongHidden; + public final boolean forceAllowVMAnnotations; + + public boolean addedToRegistry() { + return !isHidden(); + } + + public boolean isHidden() { + return isHidden; + } + + public boolean isStrongHidden() { + return isStrongHidden; + } + + public boolean forceAllowVMAnnotations() { + return forceAllowVMAnnotations; + } + + public int patchFlags(int classFlags) { + int flags = classFlags; + if (isHidden()) { + flags |= Constants.ACC_IS_HIDDEN_CLASS; + } + return flags; + } + + @Override + public String toString() { + if (this == EMPTY) { + return "EMPTY"; + } + if (!isHidden) { + return "ClassDefinitionInfo{protectionDomain=" + protectionDomain + "}"; + } + return "ClassDefinitionInfo{" + + "protectionDomain=" + protectionDomain + + ", dynamicNest=" + dynamicNest + + ", classData=" + classData + + ", isHidden=" + isHidden + + ", isStrongHidden=" + isStrongHidden + + ", forceAllowVMAnnotations=" + forceAllowVMAnnotations + + '}'; + } } public static ResolvedJavaType createInterpreterType(DynamicHub hub, ResolvedJavaType analysisType) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AOTClassRegistry.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AOTClassRegistry.java new file mode 100644 index 000000000000..8ffede6ee561 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AOTClassRegistry.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025, 2025, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import java.util.concurrent.ConcurrentHashMap; + +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Type; + +/** + * This class registry is used for ClassLoader instances if runtime class loading is unsupported. + */ +public final class AOTClassRegistry extends AbstractClassRegistry { + private final ClassLoader classLoader; + + public AOTClassRegistry(ClassLoader classLoader) { + super(classLoader == null ? null : new ConcurrentHashMap<>()); + this.classLoader = classLoader; + } + + @Override + public Class loadClass(Symbol type) throws ClassNotFoundException { + Class cls = findLoadedClass(type); + if (cls != null || classLoader == null) { + return cls; + } + assert type.byteAt(0) == 'L' && type.byteAt(type.length() - 1) == ';' : type; + String name = type.subSequence(1, type.length() - 1).toString().replace('/', '.'); + cls = classLoader.loadClass(name); + var prev = runtimeClasses.put(type, cls); + assert prev == null || prev == cls; + return cls; + } + + @Override + public ClassLoader getClassLoader() { + return classLoader; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractClassRegistry.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractClassRegistry.java new file mode 100644 index 000000000000..a56aeadb0f65 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractClassRegistry.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2025, 2025, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import java.util.concurrent.ConcurrentHashMap; + +import org.graalvm.collections.EconomicMap; +import org.graalvm.nativeimage.Platform; +import org.graalvm.nativeimage.Platforms; + +import com.oracle.svm.core.SubstrateUtil; +import com.oracle.svm.core.util.ImageHeapMap; +import com.oracle.svm.espresso.classfile.descriptors.ByteSequence; +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Type; +import com.oracle.svm.espresso.classfile.descriptors.TypeSymbols; + +/** + * A class registry is the VM-internal part of a {@link java.lang.ClassLoader}. It maps class names + * to class objects, and contains entries for every class for which this loader has initiated class + * loading. + */ +public abstract class AbstractClassRegistry { + private final EconomicMap, Class> aotClasses; + /** + * Classes for which this loader has been an initiating class loader. The values are either + * Class objects or Placeholder objects. Placeholder objects are only used by + * {@link AbstractRuntimeClassRegistry} and help detect {@link ClassCircularityError} by + * reserving the entry in the classloader before the class has been fully loaded. They might + * also be used to implement parallel class loading (GR-62338). + */ + protected final ConcurrentHashMap, Object> runtimeClasses; + + AbstractClassRegistry(ConcurrentHashMap, Object> runtimeClasses) { + if (SubstrateUtil.HOSTED) { + this.aotClasses = ImageHeapMap.createNonLayeredMap(); + } else { + this.aotClasses = null; + } + this.runtimeClasses = runtimeClasses; + } + + protected final Class findAOTLoadedClass(Symbol name) { + if (aotClasses == null) { + return null; + } + return aotClasses.get(name); + } + + public final Class findLoadedClass(Symbol name) { + Class aotClass = findAOTLoadedClass(name); + if (aotClass != null || runtimeClasses == null) { + return aotClass; + } + Object maybeClass = runtimeClasses.get(name); + if (maybeClass instanceof Class entry) { + return entry; + } + return null; + } + + public abstract ClassLoader getClassLoader(); + + public abstract Class loadClass(Symbol name) throws ClassNotFoundException; + + @Platforms(Platform.HOSTED_ONLY.class) + public final void addAOTType(Class cls) { + assert !cls.isArray() && !cls.isPrimitive(); + TypeSymbols types = ClassRegistries.singleton().getTypes(); + ByteSequence typeBytes = ByteSequence.createTypeFromName(cls.getName()); + Symbol key = types.getOrCreateValidType(typeBytes, true); + assert key != null : typeBytes; + Class prev = aotClasses.put(key, cls); + assert prev == null || prev == cls; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractRuntimeClassRegistry.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractRuntimeClassRegistry.java new file mode 100644 index 000000000000..e8877beb3486 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/AbstractRuntimeClassRegistry.java @@ -0,0 +1,515 @@ +/* + * Copyright (c) 2024, 2024, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import static com.oracle.svm.espresso.classfile.Constants.ACC_SUPER; +import static com.oracle.svm.espresso.classfile.Constants.JVM_ACC_WRITTEN_FLAGS; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +import org.graalvm.nativeimage.impl.ClassLoading; + +import com.oracle.svm.core.SubstrateUtil; +import com.oracle.svm.core.hub.DynamicHub; +import com.oracle.svm.core.hub.RuntimeClassLoading; +import com.oracle.svm.core.hub.RuntimeClassLoading.ClassDefinitionInfo; +import com.oracle.svm.core.jdk.Target_java_lang_ClassLoader; +import com.oracle.svm.core.util.VMError; +import com.oracle.svm.espresso.classfile.ClassfileParser; +import com.oracle.svm.espresso.classfile.ClassfileStream; +import com.oracle.svm.espresso.classfile.ParserConstantPool; +import com.oracle.svm.espresso.classfile.ParserException; +import com.oracle.svm.espresso.classfile.ParserKlass; +import com.oracle.svm.espresso.classfile.attributes.InnerClassesAttribute; +import com.oracle.svm.espresso.classfile.attributes.NestHostAttribute; +import com.oracle.svm.espresso.classfile.attributes.PermittedSubclassesAttribute; +import com.oracle.svm.espresso.classfile.attributes.RecordAttribute; +import com.oracle.svm.espresso.classfile.attributes.SignatureAttribute; +import com.oracle.svm.espresso.classfile.attributes.SourceFileAttribute; +import com.oracle.svm.espresso.classfile.descriptors.Name; +import com.oracle.svm.espresso.classfile.descriptors.ParserSymbols.ParserNames; +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Type; +import com.oracle.svm.espresso.classfile.descriptors.ValidationException; + +import jdk.internal.misc.Unsafe; +import jdk.vm.ci.meta.MetaUtil; + +/** + * This class registry is used for ClassLoader instances if runtime class loading is supported. + *

+ * Parallel class loading is currently disabled (see {@link Target_java_lang_ClassLoader}) and not + * supported by this implementation (GR-62338). Note that the boot class loader is always considered + * parallel-capable. To prevent issues until parallel class loading is implemented, the + * {@link BootClassRegistry#doLoadClass(Symbol)} method is synchronized. + *

+ * Classloaders synchronize on a class loading lock in their loadClass implementation. When parallel + * class loading is disabled, this lock is the classloader object itself. + *

+ * When defining a class, the registry synchronizes on the classloader if it is not + * parallel-capable. + *

+ * The registry synchronizes on the classloader during class resolution (such as + * {@code Class.forName} or {@code ClassLoader.findBootstrapClassOrNull}) if the classloader is not + * parallel-capable. + *

+ * There are exactly 2 types of runtime class registries: the one used for the + * {@linkplain BootClassRegistry boot class loader} and the one used for + * {@linkplain UserDefinedClassRegistry all other class loaders}. + */ +public abstract sealed class AbstractRuntimeClassRegistry extends AbstractClassRegistry permits BootClassRegistry, UserDefinedClassRegistry { + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + private static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; + /** + * Strong hidden classes must be referenced by the class loader data to prevent them from being + * reclaimed, while not appearing in the actual registry. This field simply keeps those hidden + * classes strongly reachable from the class registry. + */ + private final Collection> strongHiddenClasses = new ArrayList<>(); + + AbstractRuntimeClassRegistry() { + super(new ConcurrentHashMap<>()); + } + + @Override + public final Class loadClass(Symbol name) throws ClassNotFoundException { + Class aotClass = findAOTLoadedClass(name); + if (aotClass != null) { + return aotClass; + } + if (isParallelClassLoader()) { + return loadClassInner(name); + } else { + if (runtimeClasses.get(name) instanceof Class entry) { + return entry; + } + synchronized (getClassLoader()) { + return loadClassInner(name); + } + } + } + + private Class loadClassInner(Symbol name) throws ClassNotFoundException { + if (getClassLoader() != null && isParallelClassLoader()) { + // GR-62338 + throw VMError.unimplemented("Parallel class loading:" + getClassLoader()); + } + Object existing = runtimeClasses.get(name); + if (existing instanceof Class entry) { + // someone else won the race and populated the slot + return entry; + } + if (existing instanceof Placeholder placeholder && placeholder.isSuperProbingThread()) { + throw new ClassCircularityError(name.toString()); + } + Class result = doLoadClass(name); + if (result == null) { + // The boot class loader can return null + return null; + } + var prev = runtimeClasses.put(name, result); + assert prev == null || prev == result : prev; + return result; + } + + protected boolean isParallelClassLoader() { + return isParallelClassLoader(getClassLoader()); + } + + private static boolean isParallelClassLoader(ClassLoader loader) { + if (loader == null) { + // The boot class loader is always considered parallel + return true; + } + return SubstrateUtil.cast(loader, Target_java_lang_ClassLoader.class).parallelLockMap != null; + } + + protected abstract Class doLoadClass(Symbol type) throws ClassNotFoundException; + + protected abstract boolean loaderIsBootOrPlatform(); + + public final Class defineClass(Symbol typeOrNull, byte[] b, int off, int len, ClassDefinitionInfo info) { + if (isParallelClassLoader()) { + return defineClassInner(typeOrNull, b, off, len, info); + } else { + synchronized (getClassLoader()) { + return defineClassInner(typeOrNull, b, off, len, info); + } + } + } + + private Class defineClassInner(Symbol typeOrNull, byte[] b, int off, int len, ClassDefinitionInfo info) { + if (isParallelClassLoader() || getClassLoader() == null) { + // GR-62338 + throw VMError.unimplemented("Parallel class loading:" + getClassLoader()); + } + byte[] data = b; + if (off != 0 || b.length != len) { + if (len < 0) { + throw new ArrayIndexOutOfBoundsException("Length " + len + " is negative"); + } + if (off < 0 || off > b.length - len) { + throw new ArrayIndexOutOfBoundsException("Array region " + off + ".." + ((long) off + len) + " out of bounds for length " + len); + } + data = Arrays.copyOfRange(data, off, off + len); + } + ParserKlass parsed = parseClass(typeOrNull, info, data); + Symbol type = typeOrNull == null ? parsed.getType() : typeOrNull; + assert typeOrNull == null || type == parsed.getType(); + if (info.addedToRegistry() && findLoadedClass(type) != null) { + String kind; + if (Modifier.isInterface(parsed.getFlags())) { + kind = "interface"; + } else if (Modifier.isAbstract(parsed.getFlags())) { + kind = "abstract class"; + } else { + kind = "class"; + } + String externalName = getExternalName(parsed, info); + throw new LinkageError("Loader " + ClassRegistries.loaderNameAndId(getClassLoader()) + " attempted duplicate " + kind + " definition for " + externalName + "."); + } + Class clazz; + try { + clazz = createClass(parsed, info, type); + } catch (ParserException.ClassFormatError error) { + throw new ClassFormatError(error.getMessage()); + } + if (info.addedToRegistry()) { + registerClass(clazz, type); + } else if (info.isStrongHidden()) { + registerStrongHiddenClass(clazz); + } + return clazz; + } + + private ParserKlass parseClass(Symbol typeOrNull, ClassDefinitionInfo info, byte[] data) { + boolean verifiable = RuntimeClassLoading.Options.ClassVerification.getValue().needsVerification(getClassLoader()); + try { + return ClassfileParser.parse(ClassRegistries.getParsingContext(), new ClassfileStream(data, null), verifiable, loaderIsBootOrPlatform(), typeOrNull, info.isHidden(), + info.forceAllowVMAnnotations(), verifiable); + } catch (ValidationException | ParserException.ClassFormatError validationOrBadFormat) { + throw new ClassFormatError(validationOrBadFormat.getMessage()); + } catch (ParserException.UnsupportedClassVersionError unsupportedClassVersionError) { + throw new UnsupportedClassVersionError(unsupportedClassVersionError.getMessage()); + } catch (ParserException.NoClassDefFoundError noClassDefFoundError) { + throw new NoClassDefFoundError(noClassDefFoundError.getMessage()); + } catch (ParserException parserException) { + throw VMError.shouldNotReachHere("Not a validation nor parser exception", parserException); + } + } + + private Class createClass(ParserKlass parsed, ClassDefinitionInfo info, Symbol type) { + Symbol superKlassType = parsed.getSuperKlass(); + assert superKlassType != null; // j.l.Object is always AOT + // Load direct super interfaces + Symbol[] superInterfacesTypes = parsed.getSuperInterfaces(); + Class[] superInterfaces = superInterfacesTypes.length == 0 ? EMPTY_CLASS_ARRAY : new Class[superInterfacesTypes.length]; + for (int i = 0; i < superInterfacesTypes.length; ++i) { + superInterfaces[i] = loadSuperType(type, superInterfacesTypes[i]); + if (!superInterfaces[i].isInterface()) { + throw new IncompatibleClassChangeError("Class " + parsed.getType() + " cannot implement " + superInterfaces[i] + ", because it is not an interface"); + } + } + + Class superClass = loadSuperType(type, superKlassType); + if (superClass.isInterface()) { + throw new IncompatibleClassChangeError("Class " + parsed.getType() + " has interface " + superKlassType + " as super class"); + } + if (Modifier.isFinal(superClass.getModifiers())) { + throw new IncompatibleClassChangeError("Class " + parsed.getType() + " is a subclass of final class " + superKlassType); + } + // GR-62339: Perform super class and interfaces access checks + + String externalName = getExternalName(parsed, info); + String simpleBinaryName = getSimpleBinaryName(parsed); + String sourceFile = getSourceFile(parsed); + Class nestHost = getNestHost(parsed); + Class enclosingClass = getEnclosingClass(parsed); + String classSignature = getClassSignature(parsed); + + int modifiers = getClassModifiers(parsed); + + boolean isInterface = Modifier.isInterface(modifiers); + boolean isRecord = Modifier.isFinal(modifiers) && superClass == Record.class && parsed.getAttribute(RecordAttribute.NAME) != null; + // GR-62320 This should be set based on build-time and run-time arguments. + boolean assertionsEnabled = true; + // GR-59687 itable setup should set this + boolean declaresDefaultMethods = false; + boolean hasDefaultMethods = declaresDefaultMethods || hasInheritedDefaultMethods(superClass, superInterfaces); + boolean isSealed = isSealed(parsed); + + short flags = DynamicHub.makeFlags(false, isInterface, info.isHidden(), isRecord, assertionsEnabled, hasDefaultMethods, declaresDefaultMethods, isSealed, false, false, false, false); + + Object interfacesEncoding = null; + if (superInterfaces.length == 1) { + interfacesEncoding = DynamicHub.fromClass(superInterfaces[0]); + } else if (superInterfaces.length > 1) { + DynamicHub[] superHubs = new DynamicHub[superInterfaces.length]; + for (int i = 0; i < superHubs.length; ++i) { + superHubs[i] = DynamicHub.fromClass(superInterfaces[i]); + } + interfacesEncoding = superHubs; + } + + DynamicHub hub = DynamicHub.allocate(externalName, DynamicHub.fromClass(superClass), interfacesEncoding, null, + sourceFile, modifiers, flags, getClassLoader(), nestHost, simpleBinaryName, enclosingClass, classSignature); + + return DynamicHub.toClass(hub); + } + + private static boolean isSealed(ParserKlass parsed) { + PermittedSubclassesAttribute permittedSubclasses = (PermittedSubclassesAttribute) parsed.getAttribute(PermittedSubclassesAttribute.NAME); + return permittedSubclasses != null && permittedSubclasses.getClasses().length > 0; + } + + private static boolean hasInheritedDefaultMethods(Class superClass, Class[] superInterfaces) { + if (DynamicHub.fromClass(superClass).hasDefaultMethods()) { + return true; + } + for (Class superInterface : superInterfaces) { + if (DynamicHub.fromClass(superInterface).hasDefaultMethods()) { + return true; + } + } + return false; + } + + private static int getClassModifiers(ParserKlass parsed) { + int modifiers = parsed.getFlags(); + InnerClassesAttribute innerClassesAttribute = (InnerClassesAttribute) parsed.getAttribute(InnerClassesAttribute.NAME); + if (innerClassesAttribute != null) { + ParserConstantPool pool = parsed.getConstantPool(); + for (int i = 0; i < innerClassesAttribute.entryCount(); i++) { + InnerClassesAttribute.Entry entry = innerClassesAttribute.entryAt(i); + if (entry.innerClassIndex != 0) { + Symbol innerClassName = pool.className(entry.innerClassIndex); + if (innerClassName.equals(parsed.getName())) { + modifiers = entry.innerClassAccessFlags; + break; + } + } + } + } + return modifiers & ~ACC_SUPER & JVM_ACC_WRITTEN_FLAGS; + } + + private static Class getNestHost(ParserKlass parsed) { + Class nestHost = null; + NestHostAttribute nestHostAttribute = (NestHostAttribute) parsed.getAttribute(NestHostAttribute.NAME); + if (nestHostAttribute != null) { + // must be lazy, should move to companion + throw VMError.unimplemented("nest host is not supported yet"); + } + return nestHost; + } + + private static String getExternalName(ParserKlass parsed, ClassDefinitionInfo info) { + String externalName = MetaUtil.internalNameToJava(parsed.getType().toString(), true, true); + if (info.isHidden()) { + int idx = externalName.lastIndexOf('+'); + char[] chars = externalName.toCharArray(); + chars[idx] = '/'; + externalName = new String(chars); + } + return externalName; + } + + private static Class getEnclosingClass(ParserKlass parsed) { + InnerClassesAttribute innerClassesAttribute = (InnerClassesAttribute) parsed.getAttribute(InnerClassesAttribute.NAME); + if (innerClassesAttribute == null) { + return null; + } + throw VMError.unimplemented("enclosing class is not supported yet"); + } + + private static String getSimpleBinaryName(ParserKlass parsed) { + InnerClassesAttribute innerClassesAttribute = (InnerClassesAttribute) parsed.getAttribute(InnerClassesAttribute.NAME); + if (innerClassesAttribute == null) { + return null; + } + ParserConstantPool pool = parsed.getConstantPool(); + for (int i = 0; i < innerClassesAttribute.entryCount(); i++) { + InnerClassesAttribute.Entry entry = innerClassesAttribute.entryAt(i); + int innerClassIndex = entry.innerClassIndex; + if (innerClassIndex != 0) { + if (pool.className(innerClassIndex) == parsed.getName()) { + if (entry.innerNameIndex == 0) { + break; + } else { + Symbol innerName = pool.utf8At(entry.innerNameIndex, "inner class name"); + return innerName.toString(); + } + } + } + } + return null; + } + + private static String getSourceFile(ParserKlass parsed) { + String sourceFile = null; + SourceFileAttribute sourceFileAttribute = (SourceFileAttribute) parsed.getAttribute(ParserNames.SourceFile); + if (sourceFileAttribute != null) { + sourceFile = parsed.getConstantPool().utf8At(sourceFileAttribute.getSourceFileIndex()).toString(); + } + return sourceFile; + } + + private static String getClassSignature(ParserKlass parsed) { + String sourceFile = null; + SignatureAttribute signatureAttribute = (SignatureAttribute) parsed.getAttribute(ParserNames.Signature); + if (signatureAttribute != null) { + sourceFile = parsed.getConstantPool().utf8At(signatureAttribute.getSignatureIndex()).toString(); + } + return sourceFile; + } + + @SuppressWarnings("try") + public final Class loadSuperType(Symbol name, Symbol superName) { + Placeholder placeholder = new Placeholder(); + var prev = runtimeClasses.putIfAbsent(name, placeholder); + if (prev instanceof Placeholder otherPlaceHolder) { + if (otherPlaceHolder.isSuperProbingThread()) { + throw new ClassCircularityError(name.toString()); + } + otherPlaceHolder.addSuperProbingThread(); + } + assert prev == null : prev; + try (var scope = ClassLoading.allowArbitraryClassLoading()) { + return loadClass(superName); + } catch (ClassNotFoundException e) { + NoClassDefFoundError error = new NoClassDefFoundError(superName.toString()); + error.initCause(e); + throw error; + } finally { + runtimeClasses.remove(name, placeholder); + } + } + + private void registerClass(Class clazz, Symbol type) { + // GR-62320: record constraints + var previous = runtimeClasses.put(type, clazz); + assert previous == null; + } + + private void registerStrongHiddenClass(Class clazz) { + strongHiddenClasses.add(clazz); + } + + /** + * See {@link AbstractClassRegistry#runtimeClasses}. + */ + private static final class Placeholder extends CompletableFuture> { + private static final long SUPER_PROBING_OFFSET = UNSAFE.objectFieldOffset(Placeholder.class, "otherSuperProbingThreads"); + private static final long THREAD_ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset(Thread[].class); + private static final long THREAD_ELEMENT_SIZE = UNSAFE.arrayIndexScale(Thread[].class); + private static final AtomicInteger NEXT_ID = new AtomicInteger(0); + private final int id = NEXT_ID.getAndIncrement(); + private final Thread thread; + private volatile Object otherSuperProbingThreads; + + Placeholder() { + this.thread = Thread.currentThread(); + } + + @Override + public String toString() { + return "#" + id + ' ' + thread; + } + + public boolean isSuperProbingThread() { + Thread t = Thread.currentThread(); + if (t == thread) { + return true; + } + Object others = otherSuperProbingThreads; + if (t == others) { + return true; + } + if (others instanceof Thread[] otherThreads) { + for (Thread other : otherThreads) { + if (other == t) { + return true; + } + } + } + return false; + } + + public void addSuperProbingThread() { + Thread t = Thread.currentThread(); + if (t == thread) { + return; + } + Object others = otherSuperProbingThreads; + if (others == null) { + Object found = UNSAFE.compareAndExchangeReference(this, SUPER_PROBING_OFFSET, null, t); + if (found == null) { + return; + } + others = found; + } + if (others == t) { + return; + } + if (others instanceof Thread otherThread) { + // extend to array + Object found = UNSAFE.compareAndExchangeReference(this, SUPER_PROBING_OFFSET, otherThread, new Thread[]{otherThread, t}); + if (found == otherThread) { + return; + } + others = found; + } + Thread[] otherThreads = (Thread[]) others; + while (true) { + // try to insert in existing array + for (int i = 0; i < otherThreads.length; i++) { + if (otherThreads[i] == t) { + return; + } + if (otherThreads[i] == null) { + if (UNSAFE.compareAndSetReference(otherThreads, THREAD_ARRAY_BASE_OFFSET + i * THREAD_ELEMENT_SIZE, null, t)) { + return; + } + } + } + // we have to grow + Thread[] newArray = Arrays.copyOf(otherThreads, Math.max(otherThreads.length << 1, otherThreads.length + 1)); + newArray[otherThreads.length] = t; + Object found = UNSAFE.compareAndExchangeReference(this, SUPER_PROBING_OFFSET, otherThreads, newArray); + if (found == otherThreads) { + return; + } + otherThreads = (Thread[]) found; + // try to insert in that new array + } + } + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/BootClassRegistry.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/BootClassRegistry.java new file mode 100644 index 000000000000..280c9f54982a --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/BootClassRegistry.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024, 2024, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; + +import org.graalvm.nativeimage.Platform; +import org.graalvm.nativeimage.Platforms; + +import com.oracle.svm.core.hub.RuntimeClassLoading.ClassDefinitionInfo; +import com.oracle.svm.core.util.VMError; +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Type; + +/** + * This class registry corresponds to the {@code null} class loader when runtime class loading is + * supported. + */ +public final class BootClassRegistry extends AbstractRuntimeClassRegistry { + private volatile FileSystem jrtFS; + + @Platforms(Platform.HOSTED_ONLY.class) + public BootClassRegistry() { + } + + private FileSystem getFileSystem() { + // jrtFS is lazily initialized to avoid having this FileSystem in the image heap. + FileSystem fs = jrtFS; + if (fs == null) { + synchronized (this) { + if ((fs = jrtFS) == null) { + jrtFS = fs = FileSystems.getFileSystem(URI.create("jrt:/")); + } + } + } + return fs; + } + + // synchronized until parallel class loading is implemented (GR-62338) + @Override + public synchronized Class doLoadClass(Symbol type) { + // Only looking into the jimage for now. There could be appended elements. + // see GraalServices.getSavedProperty("jdk.boot.class.path.append") + String pkg = packageFromType(type); + try { + String moduleName = ClassRegistries.getBootModuleForPackage(pkg); + if (moduleName == null) { + return null; + } + Path classPath = getFileSystem().getPath("/modules/" + moduleName + "/" + type + ".class"); + if (!Files.exists(classPath)) { + return null; + } + byte[] bytes = Files.readAllBytes(classPath); + return defineClass(type, bytes, 0, bytes.length, ClassDefinitionInfo.EMPTY); + } catch (IOException e) { + throw VMError.shouldNotReachHere(e); + } + } + + private static String packageFromType(Symbol type) { + int lastSlash = type.lastIndexOf((byte) '/'); + if (lastSlash == -1) { + return null; + } + return type.subSequence(0, lastSlash).toString(); + } + + @Override + protected boolean loaderIsBootOrPlatform() { + return true; + } + + @Override + public ClassLoader getClassLoader() { + return null; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassLoadingSupportImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassLoadingSupportImpl.java new file mode 100644 index 000000000000..12debc238488 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassLoadingSupportImpl.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2025, 2025, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import org.graalvm.nativeimage.impl.ClassLoadingSupport; + +import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton; +import com.oracle.svm.core.hub.RuntimeClassLoading; + +@AutomaticallyRegisteredImageSingleton(ClassLoadingSupport.class) +public class ClassLoadingSupportImpl implements ClassLoadingSupport { + // This should work for virtual threads so it can't be a FastThreadLocal. + private final ThreadLocal ignoreReflectionConfiguration = new ThreadLocal<>() { + @Override + protected Integer initialValue() { + return 0; + } + }; + + @Override + public boolean isSupported() { + return RuntimeClassLoading.isSupported(); + } + + @Override + public boolean followReflectionConfiguration() { + return ignoreReflectionConfiguration.get() == 0; + } + + @Override + public void startIgnoreReflectionConfigurationScope() { + int previous = ignoreReflectionConfiguration.get(); + ignoreReflectionConfiguration.set(Math.incrementExact(previous)); + } + + @Override + public void endIgnoreReflectionConfigurationScope() { + int previous = ignoreReflectionConfiguration.get(); + if (previous == 0) { + throw new IllegalStateException("Unbalanced start/end arbitrary classloading allowed scopes"); + } + assert previous > 0; + ignoreReflectionConfiguration.set(previous - 1); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassRegistries.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassRegistries.java new file mode 100644 index 000000000000..40b80267d700 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/ClassRegistries.java @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2025, 2025, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import static com.oracle.svm.core.MissingRegistrationUtils.throwMissingRegistrationErrors; + +import java.lang.reflect.Field; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; + +import org.graalvm.collections.EconomicMap; +import org.graalvm.collections.MapCursor; +import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.Platform; +import org.graalvm.nativeimage.Platforms; +import org.graalvm.nativeimage.hosted.FieldValueTransformer; +import org.graalvm.nativeimage.impl.ClassLoadingSupport; + +import com.oracle.svm.core.SubstrateUtil; +import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton; +import com.oracle.svm.core.hub.ClassForNameSupport; +import com.oracle.svm.core.hub.DynamicHub; +import com.oracle.svm.core.hub.RuntimeClassLoading; +import com.oracle.svm.core.hub.RuntimeClassLoading.ClassDefinitionInfo; +import com.oracle.svm.core.jdk.Target_java_lang_ClassLoader; +import com.oracle.svm.core.log.Log; +import com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils; +import com.oracle.svm.core.util.VMError; +import com.oracle.svm.espresso.classfile.JavaVersion; +import com.oracle.svm.espresso.classfile.ParsingContext; +import com.oracle.svm.espresso.classfile.descriptors.ByteSequence; +import com.oracle.svm.espresso.classfile.descriptors.ModifiedUTF8; +import com.oracle.svm.espresso.classfile.descriptors.Name; +import com.oracle.svm.espresso.classfile.descriptors.NameSymbols; +import com.oracle.svm.espresso.classfile.descriptors.ParserSymbols; +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Symbols; +import com.oracle.svm.espresso.classfile.descriptors.Type; +import com.oracle.svm.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.svm.espresso.classfile.descriptors.Utf8Symbols; +import com.oracle.svm.espresso.classfile.perf.TimerCollection; +import com.oracle.svm.util.ReflectionUtil; + +import jdk.graal.compiler.api.replacements.Fold; +import jdk.internal.loader.BootLoader; +import jdk.internal.misc.PreviewFeatures; + +/** + * Class registries are used when native image respects the class loader hierarchy. There is one + * {@linkplain AbstractClassRegistry registry} per class loader. Each registry maps class names to + * classes. This allows multiple class loaders to load classes with the same name without conflicts. + *

+ * Class registries are attached to class loaders through an + * {@linkplain Target_java_lang_ClassLoader#classRegistry injected field}, which binds their + * lifetime to that of the class loader. + *

+ * Classes that require dynamic lookup via reflection or other mechanisms at runtime are + * pre-registered in their respective declaring class loader's registry during build time. At + * runtime class registries can grow in 2 ways: + *

    + *
  • When a class lookup is answered through delegation rather than directly. This means the next + * lookup can use that cached answer directly as required by JVMS sect. 5.3.1 & 5.3.2.
  • + *
  • When a class is defined (i.e., by runtime class loading when it's enabled)
  • + *
+ */ +@AutomaticallyRegisteredImageSingleton +public final class ClassRegistries implements ParsingContext { + public final TimerCollection timers = TimerCollection.create(false); + + @Platforms(Platform.HOSTED_ONLY.class)// + private final ConcurrentHashMap buildTimeRegistries; + + private final Utf8Symbols utf8; + private final NameSymbols names; + private final TypeSymbols types; + private final AbstractClassRegistry bootRegistry; + private final EconomicMap bootPackageToModule; + + @Platforms(Platform.HOSTED_ONLY.class) + public ClassRegistries() { + if (RuntimeClassLoading.isSupported()) { + bootRegistry = new BootClassRegistry(); + } else { + bootRegistry = new AOTClassRegistry(null); + } + ParserSymbols.ensureInitialized(); + int initialSymbolTableCapacity = 4 * 1024; + Symbols symbols = Symbols.fromExisting(ParserSymbols.SYMBOLS.freeze(), initialSymbolTableCapacity, 0); + // let this resize when first used at runtime + utf8 = new Utf8Symbols(symbols); + names = new NameSymbols(symbols); + types = new TypeSymbols(symbols); + buildTimeRegistries = new ConcurrentHashMap<>(); + bootPackageToModule = computeBootPackageToModuleMap(); + } + + private static EconomicMap computeBootPackageToModuleMap() { + Field moduleField = ReflectionUtil.lookupField(ReflectionUtil.lookupClass(false, "java.lang.NamedPackage"), "module"); + EconomicMap bootPackageToModule = EconomicMap.create(); + BootLoader.packages().forEach(p -> { + try { + bootPackageToModule.put(p.getName(), ((Module) moduleField.get(p)).getName()); + } catch (IllegalAccessException e) { + throw VMError.shouldNotReachHere(e); + } + }); + return bootPackageToModule; + } + + @Fold + static ClassRegistries singleton() { + return ImageSingletons.lookup(ClassRegistries.class); + } + + static String getBootModuleForPackage(String pkg) { + return singleton().bootPackageToModule.get(pkg); + } + + public static String[] getSystemPackageNames() { + String[] result = new String[singleton().bootPackageToModule.size()]; + MapCursor cursor = singleton().bootPackageToModule.getEntries(); + int i = 0; + while (cursor.advance()) { + result[i++] = cursor.getKey(); + } + assert i == result.length; + return result; + } + + TypeSymbols getTypes() { + return types; + } + + public static Class findBootstrapClass(String name) { + try { + return singleton().resolve(name, null); + } catch (ClassNotFoundException e) { + throw VMError.shouldNotReachHere("The boot class loader shouldn't throw ClassNotFoundException", e); + } + } + + public static Class findLoadedClass(String name, ClassLoader loader) { + if (throwMissingRegistrationErrors() && RuntimeClassLoading.followReflectionConfiguration() && !ClassForNameSupport.isRegisteredClass(name)) { + MissingReflectionRegistrationUtils.forClass(name); + return null; + } + ByteSequence typeBytes = ByteSequence.createTypeFromName(name); + Symbol type = singleton().getTypes().lookupValidType(typeBytes); + Class result = null; + if (type != null) { + result = singleton().getRegistry(loader).findLoadedClass(type); + } + return result; + } + + public static ParsingContext getParsingContext() { + assert RuntimeClassLoading.isSupported(); + return singleton(); + } + + public static Class forName(String name, ClassLoader loader) throws ClassNotFoundException { + return singleton().resolveOrThrowException(name, loader); + } + + private Class resolveOrThrowException(String name, ClassLoader loader) throws ClassNotFoundException { + Class clazz = resolve(name, loader); + if (clazz == null) { + throw new ClassNotFoundException(name); + } + return clazz; + } + + /** + * This resolves the given class name. Expects dot-names. + *

+ * It may or may not throw a {@link ClassNotFoundException} if the class is not found: the boot + * class loader returns null while user-defined class loaders throw + * {@link ClassNotFoundException}. This approach avoids unnecessary exceptions during class + * loader delegation. + */ + private Class resolve(String name, ClassLoader loader) throws ClassNotFoundException { + if (RuntimeClassLoading.followReflectionConfiguration()) { + if (throwMissingRegistrationErrors() && !ClassForNameSupport.isRegisteredClass(name)) { + MissingReflectionRegistrationUtils.forClass(name); + if (loader == null) { + return null; + } + throw new ClassNotFoundException(name); + } + if (!RuntimeClassLoading.isSupported()) { + Throwable savedException = ClassForNameSupport.getSavedException(name); + if (savedException != null) { + if (savedException instanceof Error error) { + throw error; + } else if (savedException instanceof ClassNotFoundException cnfe) { + throw cnfe; + } + throw VMError.shouldNotReachHere("Unexpected exception type", savedException); + } + } + } + int arrayDimensions = 0; + while (arrayDimensions < name.length() && name.charAt(arrayDimensions) == '[') { + arrayDimensions++; + } + if (arrayDimensions == name.length()) { + throw new ClassNotFoundException(name); + } + Class elementalResult; + if (arrayDimensions > 0) { + /* + * We know that the array name was registered for reflection. The elemental type might + * not be, so we have to ignore registration during its lookup. + */ + ClassLoadingSupport classLoadingSupport = ImageSingletons.lookup(ClassLoadingSupport.class); + classLoadingSupport.startIgnoreReflectionConfigurationScope(); + try { + elementalResult = resolveElementalType(name, arrayDimensions, loader); + } finally { + classLoadingSupport.endIgnoreReflectionConfigurationScope(); + } + } else { + elementalResult = resolveInstanceType(name, loader); + } + if (elementalResult == null) { + if (loader == null) { + return null; + } + throw new ClassNotFoundException(name); + } + if (arrayDimensions > 0) { + Class result = getArrayClass(name, elementalResult, arrayDimensions); + if (result == null && loader != null) { + throw new ClassNotFoundException(name); + } + return result; + } + return elementalResult; + } + + private Class resolveElementalType(String fullName, int arrayDimensions, ClassLoader loader) throws ClassNotFoundException { + if (fullName.length() == arrayDimensions + 1) { + return switch (fullName.charAt(arrayDimensions)) { + case 'Z' -> boolean.class; + case 'B' -> byte.class; + case 'C' -> char.class; + case 'S' -> short.class; + case 'I' -> int.class; + case 'F' -> float.class; + case 'J' -> long.class; + case 'D' -> double.class; + default -> null; // also 'V' + }; + } + assert fullName.length() > arrayDimensions; + ByteSequence elementalType = ByteSequence.createReplacingDot(fullName, arrayDimensions); + return resolveInstanceType(loader, elementalType); + } + + private Class resolveInstanceType(String name, ClassLoader loader) throws ClassNotFoundException { + ByteSequence elementalType = ByteSequence.createTypeFromName(name); + return resolveInstanceType(loader, elementalType); + } + + private Class resolveInstanceType(ClassLoader loader, ByteSequence elementalType) throws ClassNotFoundException { + Symbol type = getTypes().getOrCreateValidType(elementalType); + if (type == null) { + return null; + } + return getRegistry(loader).loadClass(type); + } + + private static Class getArrayClass(String name, Class elementalResult, int arrayDimensions) { + DynamicHub hub = SubstrateUtil.cast(elementalResult, DynamicHub.class); + int remainingDims = arrayDimensions; + while (remainingDims > 0) { + if (hub.getArrayHub() == null) { + if (RuntimeClassLoading.isSupported()) { + RuntimeClassLoading.getOrCreateArrayHub(hub); + } else { + if (throwMissingRegistrationErrors()) { + MissingReflectionRegistrationUtils.forClass(name); + } + return null; + } + } + remainingDims--; + hub = hub.getArrayHub(); + } + return SubstrateUtil.cast(hub, Class.class); + } + + public static Class defineClass(ClassLoader loader, String name, byte[] b, int off, int len, ClassDefinitionInfo info) { + // name is a "binary name": `foo.Bar$1` + assert RuntimeClassLoading.isSupported(); + if (RuntimeClassLoading.followReflectionConfiguration() && throwMissingRegistrationErrors() && !ClassForNameSupport.isRegisteredClass(name)) { + MissingReflectionRegistrationUtils.forClass(name); + // The defineClass path usually can't throw ClassNotFoundException + throw sneakyThrow(new ClassNotFoundException(name)); + } + ByteSequence typeBytes = ByteSequence.createTypeFromName(name); + Symbol type = singleton().getTypes().getOrCreateValidType(typeBytes); + if (type == null) { + throw new NoClassDefFoundError(name); + } + AbstractRuntimeClassRegistry registry = (AbstractRuntimeClassRegistry) singleton().getRegistry(loader); + return registry.defineClass(type, b, off, len, info); + } + + @SuppressWarnings("unchecked") + private static RuntimeException sneakyThrow(Throwable ex) throws T { + throw (T) ex; + } + + public static String loaderNameAndId(ClassLoader loader) { + if (loader == null) { + return "bootstrap"; + } + return SubstrateUtil.cast(loader, Target_java_lang_ClassLoader.class).nameAndId(); + } + + private AbstractClassRegistry getRegistry(ClassLoader loader) { + if (loader == null) { + return bootRegistry; + } + Target_java_lang_ClassLoader svmLoader = SubstrateUtil.cast(loader, Target_java_lang_ClassLoader.class); + AbstractClassRegistry registry = svmLoader.classRegistry; + if (registry == null) { + synchronized (loader) { + registry = svmLoader.classRegistry; + if (registry == null) { + if (RuntimeClassLoading.isSupported()) { + registry = new UserDefinedClassRegistry(loader); + } else { + registry = new AOTClassRegistry(loader); + } + svmLoader.classRegistry = registry; + } + } + } + return registry; + } + + @Platforms(Platform.HOSTED_ONLY.class) + public static void addAOTClass(ClassLoader loader, Class cls) { + singleton().getBuildTimeRegistry(loader).addAOTType(cls); + } + + @Platforms(Platform.HOSTED_ONLY.class) + private AbstractClassRegistry getBuildTimeRegistry(ClassLoader loader) { + if (loader == null) { + return bootRegistry; + } + return this.buildTimeRegistries.computeIfAbsent(loader, l -> { + AbstractClassRegistry newRegistry; + if (RuntimeClassLoading.isSupported()) { + newRegistry = new UserDefinedClassRegistry(l); + } else { + newRegistry = new AOTClassRegistry(l); + } + return newRegistry; + }); + } + + public static class ClassRegistryComputer implements FieldValueTransformer { + @Override + public Object transform(Object receiver, Object originalValue) { + assert receiver != null; + return ClassRegistries.singleton().getBuildTimeRegistry((ClassLoader) receiver); + } + } + + @Override + public JavaVersion getJavaVersion() { + return JavaVersion.HOST_VERSION; + } + + @Override + public boolean isStrictJavaCompliance() { + return false; + } + + @Override + public TimerCollection getTimers() { + return timers; + } + + @Override + public boolean isPreviewEnabled() { + return PreviewFeatures.isEnabled(); + } + + final Logger logger = new Logger() { + // Checkstyle: Allow raw info or warning printing - begin + @Override + public void log(String message) { + Log.log().string("Warning: ").string(message).newline(); + } + + @Override + public void log(Supplier messageSupplier) { + Log.log().string("Warning: ").string(messageSupplier.get()).newline(); + } + + @Override + public void log(String message, Throwable throwable) { + Log.log().string("Warning: ").string(message).newline(); + Log.log().exception(throwable); + } + // Checkstyle: Allow raw info or warning printing - end + }; + + @Override + public Logger getLogger() { + return logger; + } + + @Override + public Symbol getOrCreateName(ByteSequence byteSequence) { + return ClassRegistries.singleton().names.getOrCreate(byteSequence); + } + + @Override + public Symbol getOrCreateTypeFromName(ByteSequence byteSequence) { + return ClassRegistries.singleton().getTypes().getOrCreateValidType(TypeSymbols.nameToType(byteSequence)); + } + + @Override + public Symbol getOrCreateUtf8(ByteSequence byteSequence) { + // Note: all symbols are strong for now + return ClassRegistries.singleton().utf8.getOrCreateValidUtf8(byteSequence, true); + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/UserDefinedClassRegistry.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/UserDefinedClassRegistry.java new file mode 100644 index 000000000000..4fce34cc4d64 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/registry/UserDefinedClassRegistry.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024, 2024, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.core.hub.registry; + +import java.util.Objects; + +import com.oracle.svm.espresso.classfile.descriptors.Symbol; +import com.oracle.svm.espresso.classfile.descriptors.Type; + +import jdk.internal.loader.ClassLoaders; + +/** + * This class registry corresponds to any non-null class loader when runtime class loading is + * supported. + *

+ * Note that "user-defined" should be understood from the JVM's point of view: it is any type of + * classloader that extends {@link ClassLoader}, including those that are part of the standard + * library. + */ +public final class UserDefinedClassRegistry extends AbstractRuntimeClassRegistry { + private final ClassLoader loader; + private final boolean isPlatform; + + UserDefinedClassRegistry(ClassLoader loader) { + this.loader = Objects.requireNonNull(loader); + this.isPlatform = loader == ClassLoaders.platformClassLoader(); + } + + @Override + public Class doLoadClass(Symbol type) throws ClassNotFoundException { + assert type.byteAt(0) == 'L' && type.byteAt(type.length() - 1) == ';' : type; + String name = type.subSequence(1, type.length() - 1).toString().replace('/', '.'); + return loader.loadClass(name); + } + + @Override + protected boolean loaderIsBootOrPlatform() { + return isPlatform; + } + + @Override + public ClassLoader getClassLoader() { + return loader; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java index a9b3343b74c9..b5d4988007ec 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/JavaLangSubstitutions.java @@ -66,6 +66,7 @@ import com.oracle.svm.core.fieldvaluetransformer.FieldValueTransformerWithAvailability; import com.oracle.svm.core.hub.ClassForNameSupport; import com.oracle.svm.core.hub.DynamicHub; +import com.oracle.svm.core.hub.registry.ClassRegistries; import com.oracle.svm.core.monitor.MonitorSupport; import com.oracle.svm.core.snippets.SubstrateForeignCallTarget; import com.oracle.svm.core.thread.JavaThreads; @@ -627,6 +628,7 @@ static Package getDefinedPackage(String name) { } @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) public static Stream packages() { Target_jdk_internal_loader_BuiltinClassLoader bootClassLoader = Target_jdk_internal_loader_ClassLoaders.bootLoader(); Target_java_lang_ClassLoader systemClassLoader = SubstrateUtil.cast(bootClassLoader, Target_java_lang_ClassLoader.class); @@ -634,15 +636,27 @@ public static Stream packages() { } @Delete("only used by #packages()") - private static native String[] getSystemPackageNames(); + @TargetElement(name = "getSystemPackageNames", onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + private static native String[] getSystemPackageNamesDeleted(); @Substitute + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class) + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/BootLoader.c#L37-L41") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L3003-L3007") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/classfile/classLoader.cpp#L907-L924") + private static String[] getSystemPackageNames() { + return ClassRegistries.getSystemPackageNames(); + } + + @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class loadClassOrNull(String name) { return ClassForNameSupport.forNameOrNull(name, null); } @SuppressWarnings("unused") @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) private static Class loadClass(Module module, String name) { /* The module system is not supported for now, therefore the module parameter is ignored. */ return ClassForNameSupport.forNameOrNull(name, null); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java index 78b18292e05d..9a2a6d699a6e 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/SunMiscSubstitutions.java @@ -43,11 +43,11 @@ import com.oracle.svm.core.heap.ReferenceAccess; import com.oracle.svm.core.hub.DynamicHub; import com.oracle.svm.core.hub.LayoutEncoding; -import com.oracle.svm.core.hub.PredefinedClassesSupport; +import com.oracle.svm.core.hub.RuntimeClassLoading; import com.oracle.svm.core.memory.NativeMemory; import com.oracle.svm.core.nmt.NmtCategory; import com.oracle.svm.core.os.VirtualMemoryProvider; -import com.oracle.svm.core.util.VMError; +import com.oracle.svm.core.util.BasedOnJDKFile; import jdk.graal.compiler.nodes.extended.MembarNode; import jdk.graal.compiler.word.Word; @@ -138,11 +138,6 @@ public void ensureClassInitialized(Class c) { DynamicHub.fromClass(c).ensureInitialized(); } - @Substitute - private Class defineClass(String name, byte[] b, int off, int len, ClassLoader loader, ProtectionDomain protectionDomain) { - return PredefinedClassesSupport.loadClass(loader, name, b, off, len, protectionDomain); - } - @Substitute private int getLoadAverage0(double[] loadavg, int nelems) { /* Adapted from `Unsafe_GetLoadAverage0` in `src/hotspot/share/prims/unsafe.cpp`. */ @@ -192,9 +187,12 @@ public Object getUncompressedObject(long address) { private native int arrayIndexScale0(Class arrayClass); @Substitute + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/unsafe.cpp#L708-L712") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/unsafe.cpp#L649-L705") @SuppressWarnings("unused") private Class defineClass0(String name, byte[] b, int off, int len, ClassLoader loader, ProtectionDomain protectionDomain) { - throw VMError.unsupportedFeature("Target_Unsafe_Core.defineClass0(String, byte[], int, int, ClassLoader, ProtectionDomain)"); + // Note that if name is not null, it is a binary name in either / or .-form + return RuntimeClassLoading.defineClass(loader, name, b, off, len, new RuntimeClassLoading.ClassDefinitionInfo(protectionDomain)); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java index 875126ca0b04..9a9e34a666da 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_lang_ClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,24 +35,52 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; +import org.graalvm.nativeimage.hosted.FieldValueTransformer; + import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.annotate.Alias; import com.oracle.svm.core.annotate.Delete; +import com.oracle.svm.core.annotate.Inject; import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.hub.ClassForNameSupport; import com.oracle.svm.core.hub.PredefinedClassesSupport; import com.oracle.svm.core.hub.RuntimeClassLoading; -import com.oracle.svm.core.option.SubstrateOptionsParser; +import com.oracle.svm.core.hub.RuntimeClassLoading.ClassDefinitionInfo; +import com.oracle.svm.core.hub.registry.AbstractClassRegistry; +import com.oracle.svm.core.hub.registry.ClassRegistries; +import com.oracle.svm.core.util.BasedOnJDKFile; import com.oracle.svm.core.util.VMError; +import com.oracle.svm.util.ReflectionUtil; import jdk.graal.compiler.java.LambdaUtils; import jdk.graal.compiler.util.Digest; import jdk.internal.loader.ClassLoaderValue; import jdk.internal.loader.NativeLibrary; +/** + * Note that we currently disable parallel class loading at image run time because the + * {@linkplain RuntimeClassLoading runtime class loading} implementation doesn't support parallel + * class loading (GR-62338). In particular this means: + *

    + *
  • {@code ClassLoader.parallelLockMap} is reset to null for class loaders that are part of the + * image heap.
  • + *
  • {@code ClassLoader.assertionLock} is reset to "this" for class loaders that are part of the + * image heap.
  • + *
  • {@code ClassLoader.ParallelLoaders.loaderTypes} is reset to an empty set.
  • + *
  • Class loaders created at runtime will also have parallel class loading disabled since a class + * loader can only be parallel if their superclass is parallel.
  • + *
+ *

+ * Depending on the value of the {@code ClassForNameRespectsClassLoader} flag, methods that lookup + * classes by name (such as {@code ClassLoader#findLoadedClass}, + * {@code ClassLoader#findBootstrapClass}, or {@code Class#forName}) will either ignore the class + * loader argument and find classes in a global namespace or respect it and look names up in + * per-class loader {@linkplain ClassRegistries registries}. + */ @TargetClass(ClassLoader.class) @SuppressWarnings("static-method") public final class Target_java_lang_ClassLoader { @@ -69,12 +97,19 @@ public final class Target_java_lang_ClassLoader { @Alias @RecomputeFieldValue(kind = Kind.Reset)// private ArrayList> classes; - @Alias @RecomputeFieldValue(kind = Kind.NewInstanceWhenNotNull, declClass = ConcurrentHashMap.class)// - private ConcurrentHashMap parallelLockMap; + @Alias @RecomputeFieldValue(kind = Kind.Reset, isFinal = true)// GR-62338 + public ConcurrentHashMap parallelLockMap; + + @Alias @RecomputeFieldValue(kind = Kind.Custom, declClass = AssertionLockComputer.class, isFinal = true) // GR-62338 + private Object assertionLock; @Alias // private static ClassLoader scl; + @Inject @RecomputeFieldValue(kind = Kind.Custom, declClass = ClassRegistries.ClassRegistryComputer.class)// + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class)// + public volatile AbstractClassRegistry classRegistry; + @Substitute public static ClassLoader getSystemClassLoader() { VMError.guarantee(scl != null); @@ -110,10 +145,8 @@ static NativeLibrary loadLibrary(Class fromClass, File file) { return null; } - @Substitute - private Class loadClass(String name) throws ClassNotFoundException { - return loadClass(name, false); - } + @Alias + public native String nameAndId(); @Alias protected native Class findLoadedClass(String name); @@ -122,6 +155,7 @@ private Class loadClass(String name) throws ClassNotFoundException { protected native Class findClass(String name); @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) @SuppressWarnings("unused") Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Class clazz = findLoadedClass(name); @@ -133,7 +167,7 @@ Class loadClass(String name, boolean resolve) throws ClassNotFoundException { } if (parent != null) { try { - clazz = parent.loadClass(name); + clazz = parent.loadClass(name, resolve); if (clazz != null) { return clazz; } @@ -146,7 +180,8 @@ Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // JDK-8265605 @Delete - static native Class findBootstrapClassOrNull(String name); + @TargetElement(name = "findBootstrapClassOrNull", onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + static native Class findBootstrapClassOrNullDeleted(String name); @Substitute // @SuppressWarnings("unused") @@ -160,9 +195,20 @@ Class loadClass(Module module, String name) { } @Substitute // + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/ClassLoader.c#L320-L329") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L1056-L1096") @SuppressWarnings({"unused"}) // private Class findLoadedClass0(String name) { - return ClassForNameSupport.forNameOrNull(name, SubstrateUtil.cast(this, ClassLoader.class)); + /* + * HotSpot supports both dot- and slash-names here as well as array types The only caller + * (findLoadedClass) errors out on slash-names and array types so we assume dot-names + */ + assert !name.contains("/") && !name.startsWith("["); + if (ClassForNameSupport.respectClassLoader()) { + return ClassRegistries.findLoadedClass(name, SubstrateUtil.cast(this, ClassLoader.class)); + } else { + return ClassForNameSupport.forNameOrNull(name, SubstrateUtil.cast(this, ClassLoader.class)); + } } /** @@ -240,81 +286,137 @@ private void clearAssertionStatus() { @Substitute @SuppressWarnings({"unused", "static-method"}) - Class defineClass(byte[] b, int off, int len) throws ClassFormatError { - return defineClass(null, b, off, len); + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + private Class defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) { + return RuntimeClassLoading.defineClass(SubstrateUtil.cast(this, ClassLoader.class), name, b, off, len, new ClassDefinitionInfo(protectionDomain)); } @Substitute @SuppressWarnings({"unused", "static-method"}) - Class defineClass(String name, byte[] b, int off, int len) throws ClassFormatError { - return defineClass(name, b, off, len, null); + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + private Class defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) { + return defineClass2(SubstrateUtil.cast(this, ClassLoader.class), name, b, b.position(), b.remaining(), protectionDomain, null); } + @Delete + @TargetElement(name = "defineClass1", onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + @SuppressWarnings("unused") + private static native Class defineClass1Deleted(ClassLoader loader, String name, byte[] b, int off, int len, ProtectionDomain pd, String source); + + @Delete + @TargetElement(name = "defineClass2", onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + private static native Class defineClass2Deleted(ClassLoader loader, String name, java.nio.ByteBuffer b, int off, int len, ProtectionDomain pd, String source); + @Substitute - @SuppressWarnings({"unused", "static-method"}) - private Class defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) { - return ClassLoaderHelper.defineClass(SubstrateUtil.cast(this, ClassLoader.class), name, b, off, len, protectionDomain); + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class) + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/ClassLoader.c#L71-L151") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L1051-L1054") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L857-L896") + private static Class defineClass1(ClassLoader loader, String name, byte[] b, int off, int len, ProtectionDomain pd, @SuppressWarnings("unused") String source) { + // Note that if name is not null, it is a binary name in either / or .-form + return RuntimeClassLoading.defineClass(loader, name, b, off, len, new ClassDefinitionInfo(pd)); } @Substitute - @SuppressWarnings({"unused", "static-method"}) - private Class defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) { + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class) + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/ClassLoader.c#L153-L213") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L1051-L1054") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L857-L896") + private static Class defineClass2(ClassLoader loader, String name, java.nio.ByteBuffer b, int off, int len, ProtectionDomain pd, @SuppressWarnings("unused") String source) { + // Note that if name is not null, it is a binary name in either / or .-form // only bother extracting the bytes if it has a chance to work if (PredefinedClassesSupport.hasBytecodeClasses() || RuntimeClassLoading.isSupported()) { byte[] array; - int off; - int len = b.remaining(); + int offset; if (b.hasArray()) { array = b.array(); - off = b.position() + b.arrayOffset(); + offset = off + b.arrayOffset(); } else { array = new byte[len]; - b.get(array); - off = 0; + b.get(off, array); + offset = 0; } - return ClassLoaderHelper.defineClass(SubstrateUtil.cast(this, ClassLoader.class), name, array, off, len, null); + return RuntimeClassLoading.defineClass(loader, name, array, offset, len, new ClassDefinitionInfo(pd)); } - throw PredefinedClassesSupport.throwNoBytecodeClasses(name); + throw RuntimeClassLoading.throwNoBytecodeClasses(name); } @Substitute - protected void resolveClass(@SuppressWarnings("unused") Class c) { - // All classes are already linked at runtime. - } - - @Delete - @SuppressWarnings("unused") - private static native Class defineClass1(ClassLoader loader, String name, byte[] b, int off, int len, ProtectionDomain pd, String source); - - @Delete - private static native Class defineClass2(ClassLoader loader, String name, java.nio.ByteBuffer b, int off, int len, ProtectionDomain pd, String source); - - @Substitute - @SuppressWarnings("unused") - private static Class defineClass0(ClassLoader loader, Class lookup, String name, byte[] b, int off, int len, ProtectionDomain pd, boolean initialize, int flags, Object classData) { + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/ClassLoader.c#L215-L283") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L1039-L1049") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L909-L1022") + private static Class defineClass0(ClassLoader loader, Class lookup, String name, byte[] b, int off, int len, ProtectionDomain pd, + @SuppressWarnings("unused") boolean initialize, int flags, Object classData) { + // Note that if name is not null, it is a binary name in either / or .-form String actualName = name; if (LambdaUtils.isLambdaClassName(name)) { actualName += Digest.digest(b); } - return PredefinedClassesSupport.loadClass(loader, actualName.replace('/', '.'), b, off, b.length, null); + boolean isNestMate = (flags & ClassLoaderHelper.NESTMATE_CLASS) != 0; + boolean isHidden = (flags & ClassLoaderHelper.HIDDEN_CLASS) != 0; + boolean isStrong = (flags & ClassLoaderHelper.STRONG_LOADER_LINK) != 0; + boolean vmAnnotations = (flags & ClassLoaderHelper.ACCESS_VM_ANNOTATIONS) != 0; + Class nest = null; + if (isNestMate) { + nest = lookup.getNestHost(); + } + ClassDefinitionInfo info; + if (isHidden) { + info = new ClassDefinitionInfo(pd, nest, classData, isStrong, vmAnnotations); + } else { + if (classData != null) { + throw new IllegalArgumentException("Class data is only applicable for hidden classes"); + } + if (isNestMate) { + throw new IllegalArgumentException("Dynamic nestmate is only applicable for hidden classes"); + } + if (!isStrong) { + throw new IllegalArgumentException("An ordinary class must be strongly referenced by its defining loader"); + } + if (vmAnnotations) { + throw new IllegalArgumentException("VM annotations only allowed for hidden classes"); + } + if (flags != ClassLoaderHelper.STRONG_LOADER_LINK) { + throw new IllegalArgumentException(String.format("invalid flags 0x%x", flags)); + } + info = new ClassDefinitionInfo(pd); + } + return RuntimeClassLoading.defineClass(loader, actualName, b, off, len, info); } // JDK-8265605 @Delete - private static native Class findBootstrapClass(String name); + @TargetElement(name = "findBootstrapClass", onlyWith = ClassForNameSupport.IgnoresClassLoader.class) + private static native Class findBootstrapClassDeleted(String name); + + @Substitute + @TargetElement(onlyWith = ClassForNameSupport.RespectsClassLoader.class) + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/java.base/share/native/libjava/ClassLoader.c#L288-L328") + @BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-25+16/src/hotspot/share/prims/jvm.cpp#L780-L800") + static Class findBootstrapClass(String name) { + /* + * HotSpot supports both dot- and slash-names here as well as array types The only caller + * (findBootstrapClassOrNull) errors out on slash-names and array types. + */ + assert !name.contains("/") && !name.startsWith("["); + return ClassRegistries.findBootstrapClass(name); + } @Delete private static native Target_java_lang_AssertionStatusDirectives retrieveDirectives(); } final class ClassLoaderHelper { - private static final String ERROR_MSG = SubstrateOptionsParser.commandArgument(RuntimeClassLoading.Options.SupportRuntimeClassLoading, "+") + " is not yet supported."; - - public static Class defineClass(ClassLoader loader, String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) { - if (PredefinedClassesSupport.hasBytecodeClasses()) { - return PredefinedClassesSupport.loadClass(loader, name, b, off, len, protectionDomain); - } - throw VMError.unimplemented(ERROR_MSG); + static final int NESTMATE_CLASS; + static final int HIDDEN_CLASS; + static final int STRONG_LOADER_LINK; + static final int ACCESS_VM_ANNOTATIONS; + static { + Class constantsClass = ReflectionUtil.lookupClass("java.lang.invoke.MethodHandleNatives$Constants"); + NESTMATE_CLASS = ReflectionUtil.readStaticField(constantsClass, "NESTMATE_CLASS"); + HIDDEN_CLASS = ReflectionUtil.readStaticField(constantsClass, "HIDDEN_CLASS"); + STRONG_LOADER_LINK = ReflectionUtil.readStaticField(constantsClass, "STRONG_LOADER_LINK"); + ACCESS_VM_ANNOTATIONS = ReflectionUtil.readStaticField(constantsClass, "ACCESS_VM_ANNOTATIONS"); } } @@ -322,10 +424,22 @@ public static Class defineClass(ClassLoader loader, String name, byte[] b, in final class Target_java_lang_AssertionStatusDirectives { } +@TargetClass(className = "java.lang.NamedPackage") // +final class Target_java_lang_NamedPackage { +} + @TargetClass(className = "java.lang.ClassLoader", innerClass = "ParallelLoaders") final class Target_java_lang_ClassLoader_ParallelLoaders { @Alias // - @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.FromAlias) // + @RecomputeFieldValue(kind = Kind.FromAlias) // GR-62338 private static Set> loaderTypes = Collections.newSetFromMap(new WeakHashMap<>()); } + +final class AssertionLockComputer implements FieldValueTransformer { + @Override + public Object transform(Object receiver, Object originalValue) { + assert receiver != null; + return receiver; + } +} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_loader_BuiltinClassLoader.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_loader_BuiltinClassLoader.java index 6b7bc68d4350..45fd4da1c477 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_loader_BuiltinClassLoader.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_loader_BuiltinClassLoader.java @@ -38,6 +38,8 @@ import com.oracle.svm.core.annotate.RecomputeFieldValue; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; +import com.oracle.svm.core.annotate.TargetElement; +import com.oracle.svm.core.hub.ClassForNameSupport; @TargetClass(value = jdk.internal.loader.BuiltinClassLoader.class) @SuppressWarnings({"unused", "static-method"}) @@ -47,11 +49,13 @@ final class Target_jdk_internal_loader_BuiltinClassLoader { private Map moduleToReader; @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) protected Class findClass(String name) throws ClassNotFoundException { throw new ClassNotFoundException(name); } @Substitute + @TargetElement(onlyWith = ClassForNameSupport.IgnoresClassLoader.class) protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { Target_java_lang_ClassLoader self = SubstrateUtil.cast(this, Target_java_lang_ClassLoader.class); Class clazz = self.findLoadedClass(name); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/proxy/ProxySubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/proxy/ProxySubstitutions.java index 9459f3041918..c68388ce2080 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/proxy/ProxySubstitutions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/proxy/ProxySubstitutions.java @@ -34,6 +34,7 @@ import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.hub.DynamicHub; +import com.oracle.svm.core.util.VMError; @TargetClass(java.lang.reflect.Proxy.class) final class Target_java_lang_reflect_Proxy { @@ -69,7 +70,12 @@ private static Constructor getProxyConstructor(ClassLoader loader, Class.. @Substitute public static boolean isProxyClass(Class cl) { - return DynamicHub.fromClass(cl).isProxyClass(); + DynamicHub dynamicHub = DynamicHub.fromClass(cl); + if (dynamicHub.isRuntimeLoaded()) { + // GR-63186 + throw VMError.unimplemented("isProxyClass for dynamically loaded classes"); + } + return dynamicHub.isProxyClass(); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions/JNIFunctions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions/JNIFunctions.java index d9f55dc7c5fe..7e318b2114bf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions/JNIFunctions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jni/functions/JNIFunctions.java @@ -72,7 +72,8 @@ import com.oracle.svm.core.handles.PrimitiveArrayView; import com.oracle.svm.core.heap.RestrictHeapAccess; import com.oracle.svm.core.hub.DynamicHub; -import com.oracle.svm.core.hub.PredefinedClassesSupport; +import com.oracle.svm.core.hub.RuntimeClassLoading; +import com.oracle.svm.core.hub.RuntimeClassLoading.ClassDefinitionInfo; import com.oracle.svm.core.jdk.DirectByteBufferUtil; import com.oracle.svm.core.jni.JNIObjectFieldAccess; import com.oracle.svm.core.jni.JNIObjectHandles; @@ -1110,13 +1111,10 @@ static JNIObjectHandle DefineClass(JNIEnvironment env, CCharPointer cname, JNIOb throw new ClassFormatError(); } String name = Utf8.utf8ToString(cname); - if (name != null) { // inverse to HotSpot fixClassname(): - name = name.replace('/', '.'); - } ClassLoader classLoader = JNIObjectHandles.getObject(loader); byte[] data = new byte[bufLen]; CTypeConversion.asByteBuffer(buf, bufLen).get(data); - Class clazz = PredefinedClassesSupport.loadClass(classLoader, name, data, 0, data.length, null); + Class clazz = RuntimeClassLoading.defineClass(classLoader, name, data, 0, data.length, ClassDefinitionInfo.EMPTY); return JNIObjectHandles.createLocal(clazz); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassRegistryFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassRegistryFeature.java new file mode 100644 index 000000000000..02ce91cf6ebe --- /dev/null +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassRegistryFeature.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2025, 2025, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ +package com.oracle.svm.hosted; + +import java.lang.reflect.Field; + +import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport; + +import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; +import com.oracle.svm.core.feature.InternalFeature; +import com.oracle.svm.core.fieldvaluetransformer.NewInstanceFieldValueTransformer; +import com.oracle.svm.core.hub.ClassForNameSupport; +import com.oracle.svm.core.hub.RuntimeClassLoading; +import com.oracle.svm.core.hub.registry.ClassRegistries; + +@AutomaticallyRegisteredFeature +public class ClassRegistryFeature implements InternalFeature { + @Override + public boolean isInConfiguration(IsInConfigurationAccess access) { + return ClassForNameSupport.respectClassLoader(); + } + + @Override + public void afterRegistration(AfterRegistrationAccess access) { + ImageSingletons.lookup(RuntimeClassInitializationSupport.class).initializeAtBuildTime("com.oracle.svm.espresso.classfile", + "Native Image classes needed for runtime class loading initialized at build time"); + } + + @Override + public void beforeAnalysis(BeforeAnalysisAccess a) { + FeatureImpl.BeforeAnalysisAccessImpl access = (FeatureImpl.BeforeAnalysisAccessImpl) a; + access.registerSubtypeReachabilityHandler((unused, cls) -> onTypeReachable(cls), Object.class); + /* + * This works around issues when analysis concurrently scans the readWriteLock in + * SymbolsImpl and might add a Thread to the image heap. It could be generalized (GR-62530). + */ + Field readWriteLockField = access.findField("com.oracle.svm.espresso.classfile.descriptors.SymbolsImpl", "readWriteLock"); + access.registerFieldValueTransformer(readWriteLockField, new NewInstanceFieldValueTransformer()); + } + + private static void onTypeReachable(Class cls) { + if (cls.isArray() || cls.isHidden()) { + return; + } + if (RuntimeClassLoading.isSupported() || ClassForNameSupport.isCurrentLayerRegisteredClass(cls.getName())) { + ClassRegistries.addAOTClass(ClassLoaderFeature.getRuntimeClassLoader(cls.getClassLoader()), cls); + } + } +} diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ImageClassLoader.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ImageClassLoader.java index c099c98e886e..93eba3a77e04 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ImageClassLoader.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ImageClassLoader.java @@ -261,6 +261,11 @@ public TypeResult> findClass(String name) { /** Find class, return result encoding class or failure reason. */ public TypeResult> findClass(String name, boolean allowPrimitives) { + return findClass(name, allowPrimitives, getClassLoader()); + } + + /** Find class, return result encoding class or failure reason. */ + public static TypeResult> findClass(String name, boolean allowPrimitives, ClassLoader loader) { try { if (allowPrimitives && name.indexOf('.') == -1) { Class primitive = forPrimitive(name); @@ -268,7 +273,7 @@ public TypeResult> findClass(String name, boolean allowPrimitives) { return TypeResult.forClass(primitive); } } - return TypeResult.forClass(forName(name)); + return TypeResult.forClass(forName(name, false, loader)); } catch (ClassNotFoundException | LinkageError ex) { return TypeResult.forException(name, ex); } @@ -294,7 +299,11 @@ public Class forName(String className) throws ClassNotFoundException { } public Class forName(String className, boolean initialize) throws ClassNotFoundException { - return Class.forName(className, initialize, getClassLoader()); + return forName(className, initialize, getClassLoader()); + } + + public static Class forName(String className, boolean initialize, ClassLoader loader) throws ClassNotFoundException { + return Class.forName(className, initialize, loader); } public Class forName(String className, Module module) throws ClassNotFoundException { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java index ec098837c07a..94d4e8b56bd1 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java @@ -88,6 +88,7 @@ import com.oracle.svm.core.hub.DynamicHub; import com.oracle.svm.core.reflect.SubstrateAccessor; import com.oracle.svm.core.util.VMError; +import com.oracle.svm.hosted.ClassLoaderFeature; import com.oracle.svm.hosted.ConditionalConfigurationRegistry; import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl; import com.oracle.svm.hosted.LinkAtBuildTimeSupport; @@ -262,7 +263,7 @@ private void registerClass(ConfigurationCondition condition, Class clazz, boo } if (allowForName) { - classForNameSupport.registerClass(condition, clazz); + classForNameSupport.registerClass(condition, clazz, ClassLoaderFeature.getRuntimeClassLoader(clazz.getClassLoader())); if (!MissingRegistrationUtils.throwMissingRegistrationErrors()) { /* @@ -927,7 +928,7 @@ private void registerTypesForGenericSignature(Type type, int dimension) { /* * Reflection signature parsing will try to instantiate classes via Class.forName(). */ - classForNameSupport.registerClass(clazz); + classForNameSupport.registerClass(clazz, ClassLoaderFeature.getRuntimeClassLoader(clazz.getClassLoader())); } else if (type instanceof TypeVariable) { /* Bounds are reified lazily. */ registerTypesForGenericSignature(queryGenericInfo(((TypeVariable) type)::getBounds), dimension); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/ReflectionPlugins.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/ReflectionPlugins.java index 4aaede7ed49a..d6ee18d202e7 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/ReflectionPlugins.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/snippets/ReflectionPlugins.java @@ -59,7 +59,9 @@ import com.oracle.svm.core.MissingRegistrationUtils; import com.oracle.svm.core.ParsingReason; import com.oracle.svm.core.annotate.Delete; +import com.oracle.svm.core.hub.ClassForNameSupport; import com.oracle.svm.core.hub.PredefinedClassesSupport; +import com.oracle.svm.core.hub.RuntimeClassLoading; import com.oracle.svm.core.jdk.StackTraceUtils; import com.oracle.svm.core.option.HostedOptionKey; import com.oracle.svm.core.util.VMError; @@ -319,25 +321,48 @@ private void registerClassPlugins(InvocationPlugins plugins) { } Registration r = new Registration(plugins, Class.class); - r.register(new RequiredInvocationPlugin("forName", String.class) { + r.register(new RequiredInlineOnlyInvocationPlugin("forName", String.class) { @Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode nameNode) { - return processClassForName(b, targetMethod, nameNode, ConstantNode.forBoolean(true)); + ClassLoader loader; + if (ClassForNameSupport.respectClassLoader()) { + Class callerClass = OriginalClassProvider.getJavaClass(b.getMethod().getDeclaringClass()); + loader = callerClass.getClassLoader(); + } else { + loader = imageClassLoader.getClassLoader(); + } + return processClassForName(b, targetMethod, nameNode, ConstantNode.forBoolean(true), loader); } }); - r.register(new RequiredInvocationPlugin("forName", String.class, boolean.class, ClassLoader.class) { + r.register(new RequiredInlineOnlyInvocationPlugin("forName", String.class, boolean.class, ClassLoader.class) { @Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode nameNode, ValueNode initializeNode, ValueNode classLoaderNode) { - /* - * For now, we ignore the ClassLoader parameter. We only intrinsify class names that - * are found by the ImageClassLoader, i.e., the application class loader at run - * time. We assume that every class loader used at run time delegates to the - * application class loader. - */ - return processClassForName(b, targetMethod, nameNode, initializeNode); + ClassLoader loader; + if (ClassForNameSupport.respectClassLoader()) { + if (!classLoaderNode.isJavaConstant()) { + return false; + } + loader = (ClassLoader) unboxObjectConstant(b, classLoaderNode.asJavaConstant()); + if (loader == ClassLoader.getSystemClassLoader()) { + /* + * The run time's application class loader is the build time's image class + * loader. + */ + loader = imageClassLoader.getClassLoader(); + } + } else { + /* + * When we ignore the ClassLoader parameter, we only intrinsify class names that + * are found by the ImageClassLoader, i.e., the application class loader at run + * time. We assume that every class loader used at run time delegates to the + * application class loader. + */ + loader = imageClassLoader.getClassLoader(); + } + return processClassForName(b, targetMethod, nameNode, initializeNode, loader); } }); - r.register(new RequiredInvocationPlugin("getClassLoader", Receiver.class) { + r.register(new RequiredInlineOnlyInvocationPlugin("getClassLoader", Receiver.class) { @Override public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) { return processClassGetClassLoader(b, targetMethod, receiver); @@ -381,7 +406,7 @@ private boolean processMethodHandlesLookup(GraphBuilderContext b, ResolvedJavaMe * {@link ImageClassLoader} to look up the class name, not the class loader that loaded the * native image generator. */ - private boolean processClassForName(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode nameNode, ValueNode initializeNode) { + private boolean processClassForName(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ValueNode nameNode, ValueNode initializeNode, ClassLoader loader) { Object classNameValue = unbox(b, nameNode, JavaKind.Object); Object initializeValue = unbox(b, initializeNode, JavaKind.Boolean); @@ -392,8 +417,11 @@ private boolean processClassForName(GraphBuilderContext b, ResolvedJavaMethod ta boolean initialize = (Boolean) initializeValue; Supplier targetParameters = () -> className + ", " + initialize; - TypeResult> typeResult = imageClassLoader.findClass(className, false); + TypeResult> typeResult = ImageClassLoader.findClass(className, false, loader); if (!typeResult.isPresent()) { + if (RuntimeClassLoading.isSupported()) { + return false; + } Throwable e = typeResult.getException(); return throwException(b, targetMethod, targetParameters, e.getClass(), e.getMessage()); } diff --git a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/CremaFeature.java b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/CremaFeature.java index 7e0e67043695..c9a15fc99046 100644 --- a/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/CremaFeature.java +++ b/substratevm/src/com.oracle.svm.interpreter/src/com/oracle/svm/interpreter/CremaFeature.java @@ -39,6 +39,7 @@ import com.oracle.graal.pointsto.meta.AnalysisUniverse; import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature; import com.oracle.svm.core.feature.InternalFeature; +import com.oracle.svm.core.hub.ClassForNameSupport; import com.oracle.svm.core.hub.CremaSupport; import com.oracle.svm.core.hub.RuntimeClassLoading; import com.oracle.svm.core.util.VMError; @@ -71,6 +72,7 @@ public List> getRequiredFeatures() { @Override public void afterRegistration(AfterRegistrationAccess access) { ImageSingletons.add(CremaSupport.class, new CremaSupportImpl()); + VMError.guarantee(!RuntimeClassLoading.isSupported() || ClassForNameSupport.respectClassLoader()); } private static boolean assertionsEnabled() {