Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gluon-bot committed Sep 9, 2023
2 parents e9f1e96 + f663406 commit 4dd4325
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 24 deletions.
12 changes: 6 additions & 6 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true },

"oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14", "platformspecific": true },
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-debug", "platformspecific": true },
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-sulong", "platformspecific": true },
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14", "platformspecific": true },
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-sulong", "platformspecific": true },
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15", "platformspecific": true },
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15", "platformspecific": true },
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },

"oraclejdk22": {"name": "jpg-jdk", "version": "22", "build_id": "11", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class JVMCIVersionCheck {
/**
* Minimum JVMCI version supported by Graal.
*/
private static final Version JVMCI_MIN_VERSION = new Version(23, 0, 13);
private static final Version JVMCI_MIN_VERSION = new Version(23, 1, 15);

/**
* Minimum Java release supported by Graal.
Expand Down
35 changes: 34 additions & 1 deletion substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,28 @@
}
}
},
}
},
"LLVM_LLD_STANDALONE": {
"license" : "Apache-2.0-LLVM",
"version" : "16.0.1-4-gad8c248269-bg7bf7e45f73",
"host" : "https://lafo.ssw.uni-linz.ac.at/pub/llvm-org",
"os_arch": {
"darwin": {
"aarch64": {
"urls": ["{host}/llvm-lldonly-llvmorg-{version}-darwin-aarch64.tar.gz"],
"digest": "sha512:2a8d1853deb238fa4ee14df0ebb8224b7191eb5f955e9c0f51ff2c6993a9de243eb4721e8af3f785a1ce2ba7e908ec7100e4ba70df7cf61688d6d433892b60f8",
},
"<others>": {
"optional": True,
},
},
"<others>": {
"<others>": {
"optional": True,
}
}
}
},
},

"projects": {
Expand Down Expand Up @@ -1971,6 +1992,18 @@
"clibraries/" : ["extracted-dependency:substratevm:SVM_HOSTED_NATIVE"],
"builder/clibraries/" : ["extracted-dependency:substratevm:SVM_HOSTED_NATIVE"],
"builder/lib/" : ["dependency:com.oracle.svm.native.reporterchelper"],
"./": [
{
"source_type": "extracted-dependency",
"dependency": "LLVM_LLD_STANDALONE",
"path": "*",
"exclude": [
"lib/*",
"include/*",
"share/*",
]
},
],
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.graalvm.compiler.asm.amd64.AMD64Assembler;
import org.graalvm.compiler.asm.amd64.AMD64BaseAssembler;
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
import org.graalvm.compiler.core.common.NumUtil;
import org.graalvm.compiler.core.common.Stride;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
Expand Down Expand Up @@ -105,7 +106,7 @@ public static void createAndRegister() {
int offset = 0;
Map<Register, Integer> calleeSavedRegisterOffsets = new HashMap<>();
for (Register register : calleeSavedRegisters) {
calleeSavedRegisterOffsets.put(register, offset);
int reservedSize = 0;
RegisterCategory category = register.getRegisterCategory();
boolean isXMM = category.equals(AMD64.XMM);
if (isXMM) {
Expand All @@ -119,13 +120,28 @@ public static void createAndRegister() {
}
if (isXMM && isRuntimeCompilationEnabled && AMD64CPUFeatureAccess.canUpdateCPUFeatures()) {
// we might need to save the full 512 bit vector register
offset += AMD64Kind.V512_QWORD.getSizeInBytes();
reservedSize = AMD64Kind.V512_QWORD.getSizeInBytes();
} else if (isMask && isRuntimeCompilationEnabled && AMD64CPUFeatureAccess.canUpdateCPUFeatures()) {
// we might need to save the full 64 bit mask register
offset += AMD64Kind.MASK64.getSizeInBytes();
reservedSize = AMD64Kind.MASK64.getSizeInBytes();
} else if (target.arch.getLargestStorableKind(category) != null) {
reservedSize = target.arch.getLargestStorableKind(category).getSizeInBytes();
} else {
offset += target.arch.getLargestStorableKind(category).getSizeInBytes();
// Mask registers are not present without AVX512
VMError.guarantee(
isMask && !target.arch.getFeatures().contains(CPUFeature.AVX512F) &&
!(isRuntimeCompilationEnabled && AMD64CPUFeatureAccess.canUpdateCPUFeatures()),
"unexpected register without largest storable kind: %s", register);
}
/*
* Make sure this register's offset is aligned to its size. When using only AVX512F, its
* 16-bit mask registers would otherwise mess up the alignment for larger registers.
*/
if (reservedSize > 0) {
offset = NumUtil.roundUp(offset, reservedSize);
}
calleeSavedRegisterOffsets.put(register, offset);
offset += reservedSize;
}
int calleeSavedRegistersSizeInBytes = offset;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.oracle.svm.core.BuildDirectoryProvider;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionStability;
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
Expand Down Expand Up @@ -352,12 +353,12 @@ private void setLinkerFlags(NativeLibraries nativeLibs, boolean useFallback) {

boolean useLld = false;
if (useFallback) {
Path lld = LLVMToolchain.getLLVMBinDir().resolve("ld64.lld").toAbsolutePath();
Path lld = BuildDirectoryProvider.singleton().getHome().resolve("lib").resolve("svm").resolve("bin").resolve("ld64.lld").toAbsolutePath();
if (Files.exists(lld)) {
useLld = true;
additionalPreOptions.add("-fuse-ld=" + lld);
} else {
throw new RuntimeException("The Native Image build ran into a ld64 limitation. Please use ld64.lld via `gu install llvm-toolchain` and run the same command again.");
throw new RuntimeException("This should not happen. ld64.lld should be shipped as part of Native Image, please report.");
}
}

Expand Down Expand Up @@ -407,7 +408,13 @@ public List<String> getFallbackCommand() {
public boolean shouldRunFallback(String message) {
if (Platform.includedIn(Platform.AARCH64.class)) {
/* detect ld64 limitation around inserting branch islands, retry with LLVM linker */
return message.contains("branch out of range") || message.contains("Unable to insert branch island");
if (message.contains("branch out of range") || message.contains("Unable to insert branch island")) {
return true;
}

// slightly different message with "the new linker" (~Xcode 15), e.g.:
// > ld: B/BL out of range -178777824 (max +/-128MB) to '_throw_internal_error'
return message.contains("out of range");
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ public void afterRegistration(AfterRegistrationAccess a) {
// pre-initialize TruffleLogger$LoggerCache.INSTANCE
invokeStaticMethod("com.oracle.truffle.api.TruffleLogger$LoggerCache", "getInstance", Collections.emptyList());

// enable InternalResourceCacheSymbol entry point for shared library path lookup
invokeStaticMethod("com.oracle.truffle.polyglot.InternalResourceCacheSymbol", "initialize", List.of());

profilingEnabled = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@
import com.oracle.truffle.polyglot.EngineAccessor.AbstractClassLoaderSupplier;
import org.graalvm.collections.Pair;
import org.graalvm.nativeimage.ImageInfo;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.ProcessProperties;
import org.graalvm.nativeimage.c.function.CEntryPoint;
import org.graalvm.nativeimage.c.function.CEntryPointLiteral;
import org.graalvm.nativeimage.c.function.CFunctionPointer;
import org.graalvm.polyglot.io.FileSystem;

import java.io.IOError;
Expand Down Expand Up @@ -313,7 +318,13 @@ private static Path findCacheRootOnNativeImage() {
private static Path getExecutablePath() {
assert ImageInfo.inImageRuntimeCode();
if (useInternalResources) {
return Path.of(ProcessProperties.getExecutableName());
if (ImageInfo.isExecutable()) {
return Path.of(ProcessProperties.getExecutableName());
} else if (ImageInfo.isSharedLibrary()) {
return Path.of(ProcessProperties.getObjectFile(InternalResourceCacheSymbol.SYMBOL));
} else {
throw CompilerDirectives.shouldNotReachHere("Should only be invoked within native image runtime code.");
}
} else {
throw new IllegalArgumentException("Lookup an executable name is restricted. " +
"To enable it, use '-H:+CopyLanguageResources' during the native image build.");
Expand Down Expand Up @@ -613,3 +624,35 @@ public InternalResourceCache get() {
}
}
}

/**
* A C entry point utilized for determining the shared library's location. This entry point is
* explicitly activated by the {@code TruffleBaseFeature} through reflective invocation of the
* {@link InternalResourceCacheSymbol#initialize()} method.
*/
final class InternalResourceCacheSymbol implements BooleanSupplier {

static final CEntryPointLiteral<CFunctionPointer> SYMBOL = CEntryPointLiteral.create(InternalResourceCacheSymbol.class,
"internalResourceCacheSymbol", IsolateThread.class);

private InternalResourceCacheSymbol() {
}

@Override
public boolean getAsBoolean() {
return ImageSingletons.contains(InternalResourceCacheSymbol.class);
}

/**
* Enables {@link #internalResourceCacheSymbol(IsolateThread)} entrypoint. Called reflectively
* by the {@code TruffleBaseFeature#afterRegistration()}.
*/
static void initialize() {
ImageSingletons.add(InternalResourceCacheSymbol.class, new InternalResourceCacheSymbol());
}

@CEntryPoint(name = "graal_resource_cache_symbol", publishAs = CEntryPoint.Publish.SymbolOnly, include = InternalResourceCacheSymbol.class)
@SuppressWarnings("unused")
private static void internalResourceCacheSymbol(IsolateThread thread) {
}
}
5 changes: 4 additions & 1 deletion vm/ci/ci_common/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ local devkits = graal_common.devkits;
downloads+: {
JAVA_HOME: graal_common.jdks_data['labsjdk-' + edition + '-17'],
EXTRA_JAVA_HOMES: graal_common.jdks_data['labsjdk-' + edition + '-21'],
}
},
environment+: {
JVMCI_VERSION_CHECK: 'ignore',
},
}
else if (edition == 'ee') then
{
Expand Down
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-aarch64-complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby
COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm,graalpy-polyglot-get
DISABLE_INSTALLABLES=False
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,fastr,graalpython,truffleruby
COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm,graalpy-polyglot-get
DISABLE_INSTALLABLES=false
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-darwin-aarch64-complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython,truffleruby
COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm,graalpy-polyglot-get
DISABLE_INSTALLABLES=false
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-darwin-complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,fastr,graalpython,truffleruby
COMPONENTS=antlr4,cmp,cov,dap,ellvm,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,R,rby,rbyl,rgx,sdk,sdkl,svm,svmt,svml,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:rubyvm,lib:wasmvm,graalpy-polyglot-get
DISABLE_INSTALLABLES=false
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-win-complete
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/espresso,/graal-js,/graal-nodejs,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,/wasm,graalpython
COMPONENTS=antlr4,cmp,cov,dap,ejvm,gu,gvm,gwa,icu4j,ins,insight,insightheap,java,js,jsl,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,nfi,ni,nic,nil,njs,njsl,poly,polynative,pro,pyn,pynl,rgx,sdk,sdkl,svm,svmt,svmnfi,svmsl,tfl,tfla,tflc,tflm,truffle-json,vvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:wasmvm
NATIVE_IMAGES=lib:pythonvm,graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-flang,graalvm-native-ld,lib:jsvm,lib:javavm,lib:graal-nodejs,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,lib:llvmvm,native-image,lib:wasmvm,graalpy-polyglot-get
DISABLE_INSTALLABLES=False
Loading

0 comments on commit 4dd4325

Please sign in to comment.