Skip to content

Commit

Permalink
Merge pull request #811 from jerboaa/merge-latest-upstream-2024-12-05
Browse files Browse the repository at this point in the history
Merge latest upstream (2024-12-05)
  • Loading branch information
zakkak authored Dec 5, 2024
2 parents d819fc5 + cea1572 commit c3af246
Show file tree
Hide file tree
Showing 63 changed files with 1,660 additions and 581 deletions.
2 changes: 1 addition & 1 deletion compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"sourceinprojectwhitelist" : [],

"groupId" : "org.graalvm.compiler",
"version" : "23.1.5.1",
"version" : "23.1.6.0",
"release" : False,
"url" : "http://www.graalvm.org/",
"developer" : {
Expand Down
2 changes: 1 addition & 1 deletion espresso/mx.espresso/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
suite = {
"mxversion": "6.44.0",
"name": "espresso",
"version" : "23.1.5.1",
"version" : "23.1.6.0",
"release" : False,
"groupId" : "org.graalvm.espresso",
"url" : "https://www.graalvm.org/reference-manual/java-on-truffle/",
Expand Down
2 changes: 1 addition & 1 deletion regex/mx.regex/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

"name" : "regex",

"version" : "23.1.5.1",
"version" : "23.1.6.0",
"release" : False,
"groupId" : "org.graalvm.regex",
"url" : "http://www.graalvm.org/",
Expand Down
4 changes: 2 additions & 2 deletions sdk/mx.sdk/mx_sdk_shaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ def glob_match(path, pattern):
"""
assert isinstance(path, PurePath), path
if sys.version_info[:2] >= (3, 13):
# Since Python 3.13, PurePath.match already supports '**'.
return path.match(pattern)
# Python 3.13+: PurePath.full_match already supports '**'.
return path.full_match(pattern)

pathType = type(path)
patternParts = pathType(pattern).parts
Expand Down
2 changes: 1 addition & 1 deletion sdk/mx.sdk/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
suite = {
"mxversion": "6.39.0",
"name" : "sdk",
"version" : "23.1.5.1",
"version" : "23.1.6.0",
"release" : False,
"sourceinprojectwhitelist" : [],
"url" : "https://github.com/oracle/graal",
Expand Down
4 changes: 2 additions & 2 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from glob import glob
from contextlib import contextmanager
from os.path import join, exists, dirname
import pipes
import shlex
from argparse import ArgumentParser
import fnmatch
import collections
Expand Down Expand Up @@ -585,7 +585,7 @@ def dummy_harness(test_deps, vm_launcher, vm_args):
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file] + svm_experimental_options(['-H:Path=' + junit_test_dir]), env=custom_env)
image_pattern_replacement = unittest_image + ".exe" if mx.is_windows() else unittest_image
run_args = [arg.replace('${unittest.image}', image_pattern_replacement) for arg in run_args]
mx.log('Running: ' + ' '.join(map(pipes.quote, [unittest_image] + run_args)))
mx.log('Running: ' + ' '.join(map(shlex.quote, [unittest_image] + run_args)))
mx.run([unittest_image] + run_args)
finally:
if not preserve_image:
Expand Down
2 changes: 1 addition & 1 deletion substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
suite = {
"mxversion": "6.27.1",
"name": "substratevm",
"version" : "23.1.5.1",
"version" : "23.1.6.0",
"release" : False,
"url" : "https://github.com/oracle/graal/tree/master/substratevm",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ class TypeMethodsWithFlagsTest {
final Map<ConfigurationMethod, ConfigurationMemberDeclaration> methodsThatMustExist = new HashMap<>();
final Map<ConfigurationMethod, ConfigurationMemberDeclaration> methodsThatMustNotExist = new HashMap<>();

final TypeConfiguration previousConfig = new TypeConfiguration();
final TypeConfiguration currentConfig = new TypeConfiguration();
final TypeConfiguration previousConfig = new TypeConfiguration("");
final TypeConfiguration currentConfig = new TypeConfiguration("");

TypeMethodsWithFlagsTest(ConfigurationMemberDeclaration methodKind) {
this.methodKind = methodKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
import org.junit.Test;

import com.oracle.svm.configure.config.ResourceConfiguration;
import com.oracle.svm.core.util.json.JsonWriter;
import com.oracle.svm.core.configure.ResourceConfigurationParser;
import com.oracle.svm.core.configure.ResourcesRegistry;
import com.oracle.svm.core.util.json.JsonWriter;

public class ResourceConfigurationTest {

Expand Down Expand Up @@ -117,7 +117,7 @@ public void addClassBasedResourceBundle(ConfigurationCondition condition, String
}
};

ResourceConfigurationParser rcp = new ResourceConfigurationParser(registry, true);
ResourceConfigurationParser rcp = ResourceConfigurationParser.create(false, registry, true);
writerThread.start();
rcp.parseAndRegister(pr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@

import java.util.function.Consumer;

import com.oracle.svm.core.util.json.JsonPrintable;
import com.oracle.svm.core.configure.ConfigurationParser;
import org.graalvm.nativeimage.impl.ConfigurationCondition;

import com.oracle.svm.core.configure.ConfigurationParser;
import com.oracle.svm.core.util.json.JsonPrintable;

public abstract class ConfigurationBase<T extends ConfigurationBase<T, P>, P> implements JsonPrintable {

public abstract boolean isEmpty();
Expand Down Expand Up @@ -68,5 +69,5 @@ public T copyAndFilter(P predicate) {
return copyAnd(copy -> copy.removeIf(predicate));
}

public abstract ConfigurationParser createParser();
public abstract ConfigurationParser createParser(boolean strictMetadata);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,31 @@
*/
package com.oracle.svm.configure.config;

import static com.oracle.svm.core.configure.ConfigurationParser.JNI_KEY;
import static com.oracle.svm.core.configure.ConfigurationParser.REFLECTION_KEY;

import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import com.oracle.svm.core.configure.ConfigurationFile;
import com.oracle.svm.core.configure.ConfigurationParser;
import com.oracle.svm.core.util.VMError;

public class ConfigurationFileCollection {
public static final Function<IOException, Exception> FAIL_ON_EXCEPTION = e -> e;

private final Set<URI> reachabilityMetadataPaths = new LinkedHashSet<>();
private final Set<URI> jniConfigPaths = new LinkedHashSet<>();
private final Set<URI> reflectConfigPaths = new LinkedHashSet<>();
private final Set<URI> proxyConfigPaths = new LinkedHashSet<>();
Expand All @@ -51,6 +58,7 @@ public class ConfigurationFileCollection {
private Set<URI> lockFilePaths;

public void addDirectory(Path path) {
reachabilityMetadataPaths.add(path.resolve(ConfigurationFile.REACHABILITY_METADATA.getFileName()).toUri());
jniConfigPaths.add(path.resolve(ConfigurationFile.JNI.getFileName()).toUri());
reflectConfigPaths.add(path.resolve(ConfigurationFile.REFLECTION.getFileName()).toUri());
proxyConfigPaths.add(path.resolve(ConfigurationFile.DYNAMIC_PROXY.getFileName()).toUri());
Expand All @@ -70,24 +78,51 @@ private <T> void detectAgentLock(T location, Predicate<T> exists, Function<T, UR
}

public void addDirectory(Function<String, URI> fileResolver) {
jniConfigPaths.add(fileResolver.apply(ConfigurationFile.JNI.getFileName()));
reflectConfigPaths.add(fileResolver.apply(ConfigurationFile.REFLECTION.getFileName()));
proxyConfigPaths.add(fileResolver.apply(ConfigurationFile.DYNAMIC_PROXY.getFileName()));
resourceConfigPaths.add(fileResolver.apply(ConfigurationFile.RESOURCES.getFileName()));
serializationConfigPaths.add(fileResolver.apply(ConfigurationFile.SERIALIZATION.getFileName()));
predefinedClassesConfigPaths.add(fileResolver.apply(ConfigurationFile.PREDEFINED_CLASSES_NAME.getFileName()));
addFile(reachabilityMetadataPaths, fileResolver, ConfigurationFile.REACHABILITY_METADATA);
addFile(jniConfigPaths, fileResolver, ConfigurationFile.JNI);
addFile(reflectConfigPaths, fileResolver, ConfigurationFile.REFLECTION);
addFile(proxyConfigPaths, fileResolver, ConfigurationFile.DYNAMIC_PROXY);
addFile(resourceConfigPaths, fileResolver, ConfigurationFile.RESOURCES);
addFile(serializationConfigPaths, fileResolver, ConfigurationFile.SERIALIZATION);
addFile(predefinedClassesConfigPaths, fileResolver, ConfigurationFile.PREDEFINED_CLASSES_NAME);
detectAgentLock(fileResolver.apply(ConfigurationFile.LOCK_FILE_NAME), Objects::nonNull, Function.identity());
}

private static void addFile(Set<URI> metadataPaths, Function<String, URI> fileResolver, ConfigurationFile configurationFile) {
URI uri = fileResolver.apply(configurationFile.getFileName());
if (uri != null) {
metadataPaths.add(uri);
}
}

public Set<URI> getDetectedAgentLockPaths() {
return (lockFilePaths != null) ? lockFilePaths : Collections.emptySet();
}

public boolean isEmpty() {
return jniConfigPaths.isEmpty() && reflectConfigPaths.isEmpty() && proxyConfigPaths.isEmpty() &&
return reachabilityMetadataPaths.isEmpty() && jniConfigPaths.isEmpty() && reflectConfigPaths.isEmpty() && proxyConfigPaths.isEmpty() &&
resourceConfigPaths.isEmpty() && serializationConfigPaths.isEmpty() && predefinedClassesConfigPaths.isEmpty();
}

public Set<Path> getPaths(ConfigurationFile configurationFile) {
Set<URI> uris;
switch (configurationFile) {
case REACHABILITY_METADATA -> uris = getReachabilityMetadataPaths();
case DYNAMIC_PROXY -> uris = getProxyConfigPaths();
case RESOURCES -> uris = getResourceConfigPaths();
case JNI -> uris = getJniConfigPaths();
case REFLECTION -> uris = getReflectConfigPaths();
case SERIALIZATION -> uris = getSerializationConfigPaths();
case PREDEFINED_CLASSES_NAME -> uris = getPredefinedClassesConfigPaths();
default -> throw VMError.shouldNotReachHere("Cannot get paths for configuration file " + configurationFile);
}
return uris.stream().map(Paths::get).collect(Collectors.toSet());
}

public Set<URI> getReachabilityMetadataPaths() {
return reachabilityMetadataPaths;
}

public Set<URI> getJniConfigPaths() {
return jniConfigPaths;
}
Expand All @@ -113,35 +148,37 @@ public Set<URI> getPredefinedClassesConfigPaths() {
}

public TypeConfiguration loadJniConfig(Function<IOException, Exception> exceptionHandler) throws Exception {
return loadTypeConfig(jniConfigPaths, exceptionHandler);
return loadTypeConfig(JNI_KEY, jniConfigPaths, exceptionHandler);
}

public TypeConfiguration loadReflectConfig(Function<IOException, Exception> exceptionHandler) throws Exception {
return loadTypeConfig(reflectConfigPaths, exceptionHandler);
return loadTypeConfig(REFLECTION_KEY, reflectConfigPaths, exceptionHandler);
}

public ProxyConfiguration loadProxyConfig(Function<IOException, Exception> exceptionHandler) throws Exception {
ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
loadConfig(proxyConfigPaths, proxyConfiguration.createParser(), exceptionHandler);
loadConfig(proxyConfigPaths, proxyConfiguration.createParser(false), exceptionHandler);
return proxyConfiguration;
}

public PredefinedClassesConfiguration loadPredefinedClassesConfig(Path[] classDestinationDirs, Predicate<String> shouldExcludeClassesWithHash,
Function<IOException, Exception> exceptionHandler) throws Exception {
PredefinedClassesConfiguration predefinedClassesConfiguration = new PredefinedClassesConfiguration(classDestinationDirs, shouldExcludeClassesWithHash);
loadConfig(predefinedClassesConfigPaths, predefinedClassesConfiguration.createParser(), exceptionHandler);
loadConfig(predefinedClassesConfigPaths, predefinedClassesConfiguration.createParser(false), exceptionHandler);
return predefinedClassesConfiguration;
}

public ResourceConfiguration loadResourceConfig(Function<IOException, Exception> exceptionHandler) throws Exception {
ResourceConfiguration resourceConfiguration = new ResourceConfiguration();
loadConfig(resourceConfigPaths, resourceConfiguration.createParser(), exceptionHandler);
loadConfig(reachabilityMetadataPaths, resourceConfiguration.createParser(true), exceptionHandler);
loadConfig(resourceConfigPaths, resourceConfiguration.createParser(false), exceptionHandler);
return resourceConfiguration;
}

public SerializationConfiguration loadSerializationConfig(Function<IOException, Exception> exceptionHandler) throws Exception {
SerializationConfiguration serializationConfiguration = new SerializationConfiguration();
loadConfig(serializationConfigPaths, serializationConfiguration.createParser(), exceptionHandler);
loadConfig(reachabilityMetadataPaths, serializationConfiguration.createParser(true), exceptionHandler);
loadConfig(serializationConfigPaths, serializationConfiguration.createParser(false), exceptionHandler);
return serializationConfiguration;
}

Expand All @@ -152,9 +189,10 @@ public ConfigurationSet loadConfigurationSet(Function<IOException, Exception> ex
loadPredefinedClassesConfig(predefinedConfigClassDestinationDirs, predefinedConfigClassWithHashExclusionPredicate, exceptionHandler));
}

private static TypeConfiguration loadTypeConfig(Collection<URI> uris, Function<IOException, Exception> exceptionHandler) throws Exception {
TypeConfiguration configuration = new TypeConfiguration();
loadConfig(uris, configuration.createParser(), exceptionHandler);
private TypeConfiguration loadTypeConfig(String combinedFileKey, Collection<URI> uris, Function<IOException, Exception> exceptionHandler) throws Exception {
TypeConfiguration configuration = new TypeConfiguration(combinedFileKey);
loadConfig(reachabilityMetadataPaths, configuration.createParser(true), exceptionHandler);
loadConfig(uris, configuration.createParser(false), exceptionHandler);
return configuration;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
*/
package com.oracle.svm.configure.config;

import static com.oracle.svm.core.configure.ConfigurationParser.JNI_KEY;
import static com.oracle.svm.core.configure.ConfigurationParser.REFLECTION_KEY;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
Expand All @@ -32,10 +35,10 @@

import com.oracle.svm.configure.ConfigurationBase;
import com.oracle.svm.configure.config.conditional.ConditionalConfigurationPredicate;
import com.oracle.svm.core.util.json.JsonPrintable;
import com.oracle.svm.core.util.json.JsonWriter;
import com.oracle.svm.core.configure.ConfigurationFile;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.core.util.json.JsonPrintable;
import com.oracle.svm.core.util.json.JsonWriter;

public class ConfigurationSet {
@FunctionalInterface
Expand Down Expand Up @@ -66,7 +69,7 @@ public ConfigurationSet(ConfigurationSet other) {
}

public ConfigurationSet() {
this(new TypeConfiguration(), new TypeConfiguration(), new ResourceConfiguration(), new ProxyConfiguration(), new SerializationConfiguration(),
this(new TypeConfiguration(REFLECTION_KEY), new TypeConfiguration(JNI_KEY), new ResourceConfiguration(), new ProxyConfiguration(), new SerializationConfiguration(),
new PredefinedClassesConfiguration(new Path[0], hash -> false));
}

Expand Down
Loading

0 comments on commit c3af246

Please sign in to comment.