Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
ImageSingletons.add(CommittedMemoryProvider.class, createCommittedMemoryProvider());
}

// If building libgraal, set system property showing gc algorithm
SystemPropertiesSupport.singleton().setLibGraalRuntimeProperty("gc", Heap.getHeap().getGC().getName());
if (ImageLayerBuildingSupport.firstImageBuild()) {
// If building libgraal, set system property showing gc algorithm
SystemPropertiesSupport.singleton().setLibGraalRuntimeProperty("gc", Heap.getHeap().getGC().getName());
}

// Needed for the barrier set.
access.registerAsUsed(Object[].class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,26 @@

import java.util.function.Consumer;

import jdk.graal.compiler.asm.Assembler;
import jdk.graal.compiler.asm.aarch64.AArch64Assembler.SingleInstructionAnnotation;
import jdk.graal.compiler.asm.aarch64.AArch64MacroAssembler;
import jdk.graal.compiler.code.CompilationResult;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;

import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.graal.code.NativeImagePatcher;
import com.oracle.svm.core.graal.code.PatchConsumerFactory;
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.traits.BuiltinTraits.AllAccess;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Disallowed;
import com.oracle.svm.core.traits.SingletonTraits;
import com.oracle.svm.core.util.VMError;

import jdk.graal.compiler.asm.Assembler;
import jdk.graal.compiler.asm.aarch64.AArch64Assembler.SingleInstructionAnnotation;
import jdk.graal.compiler.asm.aarch64.AArch64MacroAssembler;
import jdk.graal.compiler.code.CompilationResult;

@AutomaticallyRegisteredImageSingleton(PatchConsumerFactory.NativePatchConsumerFactory.class)
@Platforms(Platform.AARCH64.class)
@SingletonTraits(access = AllAccess.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
final class AArch64NativePatchConsumerFactory extends PatchConsumerFactory.NativePatchConsumerFactory {
@Override
public Consumer<Assembler.CodeAnnotation> newConsumer(CompilationResult compilationResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,13 @@ class SubstrateAArch64Feature implements InternalFeature {
@Override
public void afterRegistration(AfterRegistrationAccess access) {

ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateRegisterConfigFactory() {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateAArch64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
});
ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateAArch64RegisterConfigFactory());

ImageSingletons.add(ReservedRegisters.class, new AArch64ReservedRegisters());

if (!SubstrateOptions.useLLVMBackend()) {

ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateBackendFactory() {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateAArch64Backend(newProviders);
}
});
ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateAArch64BackendFactory());

ImageSingletons.add(SubstrateLoweringProviderFactory.class, new SubstrateAArch64LoweringProviderFactory());

Expand All @@ -100,6 +90,22 @@ public void duringSetup(DuringSetupAccess access) {
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
class SubstrateAArch64RegisterConfigFactory implements SubstrateRegisterConfigFactory {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateAArch64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
class SubstrateAArch64BackendFactory extends SubstrateBackendFactory {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateAArch64Backend(newProviders);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
class SubstrateAArch64LoweringProviderFactory extends SubstrateVectorArchitectureFactory implements SubstrateLoweringProviderFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@
*/
package com.oracle.svm.core.graal.aarch64;

import jdk.graal.compiler.core.phases.EconomyCompilerConfiguration;

import com.oracle.svm.core.graal.code.SubstrateSuitesCreatorProvider;
import com.oracle.svm.core.traits.BuiltinTraits.BuildtimeAccessOnly;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Disallowed;
import com.oracle.svm.core.traits.SingletonTraits;

import jdk.graal.compiler.core.phases.EconomyCompilerConfiguration;

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
public class SubstrateAArch64SuitesCreatorProvider extends SubstrateSuitesCreatorProvider {
public SubstrateAArch64SuitesCreatorProvider() {
super(new AArch64SubstrateSuitesCreator(getHostedCompilerConfiguration()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,26 @@

import java.util.function.Consumer;

import jdk.graal.compiler.asm.Assembler;
import jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.AddressDisplacementAnnotation;
import jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.OperandDataAnnotation;
import jdk.graal.compiler.code.CompilationResult;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;

import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.graal.code.NativeImagePatcher;
import com.oracle.svm.core.graal.code.PatchConsumerFactory;
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.traits.BuiltinTraits.AllAccess;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Independent;
import com.oracle.svm.core.traits.SingletonTraits;
import com.oracle.svm.core.util.VMError;

import jdk.graal.compiler.asm.Assembler;
import jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.AddressDisplacementAnnotation;
import jdk.graal.compiler.asm.amd64.AMD64BaseAssembler.OperandDataAnnotation;
import jdk.graal.compiler.code.CompilationResult;

@AutomaticallyRegisteredImageSingleton(PatchConsumerFactory.NativePatchConsumerFactory.class)
@Platforms(Platform.AMD64.class)
@SingletonTraits(access = AllAccess.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
final class AMD64NativePatchConsumerFactory extends PatchConsumerFactory.NativePatchConsumerFactory {
@Override
public Consumer<Assembler.CodeAnnotation> newConsumer(CompilationResult compilationResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,13 @@ class SubstrateAMD64Feature implements InternalFeature {
@Override
public void afterRegistration(AfterRegistrationAccess access) {

ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateRegisterConfigFactory() {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateAMD64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
});
ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateAMD64RegisterConfigFactory());

ImageSingletons.add(ReservedRegisters.class, new AMD64ReservedRegisters());

if (!SubstrateOptions.useLLVMBackend()) {

ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateBackendFactory() {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateAMD64Backend(newProviders);
}
});
ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateAMD64BackendFactory());

ImageSingletons.add(SubstrateLoweringProviderFactory.class, new SubstrateAMD64LoweringProviderFactory());

Expand All @@ -101,6 +91,22 @@ public void duringSetup(DuringSetupAccess access) {
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
class SubstrateAMD64RegisterConfigFactory implements SubstrateRegisterConfigFactory {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateAMD64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
class SubstrateAMD64BackendFactory extends SubstrateBackendFactory {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateAMD64Backend(newProviders);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
class SubstrateAMD64LoweringProviderFactory extends SubstrateVectorArchitectureFactory implements SubstrateLoweringProviderFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@
*/
package com.oracle.svm.core.graal.amd64;

import jdk.graal.compiler.core.phases.EconomyCompilerConfiguration;

import com.oracle.svm.core.graal.code.SubstrateSuitesCreatorProvider;
import com.oracle.svm.core.traits.BuiltinTraits.BuildtimeAccessOnly;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Independent;
import com.oracle.svm.core.traits.SingletonTraits;

import jdk.graal.compiler.core.phases.EconomyCompilerConfiguration;

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Independent.class)
public class SubstrateAMD64SuitesCreatorProvider extends SubstrateSuitesCreatorProvider {
public SubstrateAMD64SuitesCreatorProvider() {
super(new AMD64SubstrateSuitesCreator(getHostedCompilerConfiguration()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,13 @@ public void afterRegistration(AfterRegistrationAccess access) {

ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, LLVMFeature.class, false, "jdk.internal.vm.ci", "jdk.vm.ci.code.site", "jdk.vm.ci.code", "jdk.vm.ci.meta");

ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateBackendFactory() {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateLLVMBackend(newProviders);
}
});
ImageSingletons.add(SubstrateBackendFactory.class, new LLVMSubstrateBackendFactory());

ImageSingletons.add(SubstrateLoweringProviderFactory.class, SubstrateLLVMLoweringProvider::new);

ImageSingletons.add(NativeImageCodeCacheFactory.class, new NativeImageCodeCacheFactory() {
@Override
public NativeImageCodeCache newCodeCache(CompileQueue compileQueue, NativeImageHeap heap, Platform platform, Path tempDir) {
return new LLVMNativeImageCodeCache(compileQueue.getCompilationResults(), heap, platform, tempDir);
}
});

ImageSingletons.add(ObjectFileFactory.class, new ObjectFileFactory() {
@Override
public ObjectFile newObjectFile(int pageSize, Path tempDir, BigBang bb) {
if (LLVMOptions.UseLLVMDataSection.getValue()) {
return new LLVMObjectFile(pageSize, tempDir, bb);
} else {
return ObjectFile.getNativeObjectFile(pageSize);
}
}
});
ImageSingletons.add(NativeImageCodeCacheFactory.class, new LLVMCodeCacheFactory());

ImageSingletons.add(ObjectFileFactory.class, new LLVMObjectFileFactory());

if (LLVMOptions.UseLLVMDataSection.getValue()) {
ImageSingletons.add(CCompilerInvoker.class, new LLVMCCompilerInvoker(ImageSingletons.lookup(TemporaryBuildDirectoryProvider.class).getTemporaryBuildDirectory()));
Expand Down Expand Up @@ -187,4 +168,32 @@ private static int getLLVMVersion() {
return version;
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
private static final class LLVMSubstrateBackendFactory extends SubstrateBackendFactory {
@Override
public SubstrateBackend newBackend(Providers newProviders) {
return new SubstrateLLVMBackend(newProviders);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
private static final class LLVMCodeCacheFactory extends NativeImageCodeCacheFactory {
@Override
public NativeImageCodeCache newCodeCache(CompileQueue compileQueue, NativeImageHeap heap, Platform platform, Path tempDir) {
return new LLVMNativeImageCodeCache(compileQueue.getCompilationResults(), heap, platform, tempDir);
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
private static final class LLVMObjectFileFactory implements ObjectFileFactory {
@Override
public ObjectFile newObjectFile(int pageSize, Path tempDir, BigBang bb) {
if (LLVMOptions.UseLLVMDataSection.getValue()) {
return new LLVMObjectFile(pageSize, tempDir, bb);
} else {
return ObjectFile.getNativeObjectFile(pageSize);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package com.oracle.svm.core.graal.riscv64;

import jdk.graal.compiler.debug.GraalError;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;
Expand All @@ -35,7 +34,12 @@
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.graal.code.SubstrateRegisterConfigFactory;
import com.oracle.svm.core.graal.meta.SubstrateRegisterConfig.ConfigKind;
import com.oracle.svm.core.traits.BuiltinTraits.BuildtimeAccessOnly;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Disallowed;
import com.oracle.svm.core.traits.SingletonTraits;

import jdk.graal.compiler.debug.GraalError;
import jdk.vm.ci.code.RegisterConfig;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.meta.MetaAccessProvider;
Expand All @@ -47,12 +51,7 @@ class SubstrateRISCV64Feature implements InternalFeature {
@Override
public void afterRegistration(AfterRegistrationAccess access) {

ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateRegisterConfigFactory() {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateRISCV64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
});
ImageSingletons.add(SubstrateRegisterConfigFactory.class, new SubstrateRISCV64RegisterConfigFactory());

ImageSingletons.add(ReservedRegisters.class, new RISCV64ReservedRegisters());

Expand All @@ -61,3 +60,11 @@ public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider m
}
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
class SubstrateRISCV64RegisterConfigFactory implements SubstrateRegisterConfigFactory {
@Override
public RegisterConfig newRegisterFactory(ConfigKind config, MetaAccessProvider metaAccess, TargetDescription target, Boolean preserveFramePointer) {
return new SubstrateRISCV64RegisterConfig(config, metaAccess, target, preserveFramePointer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import jdk.graal.compiler.word.Word;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;
Expand All @@ -37,6 +36,8 @@
import com.oracle.svm.core.posix.headers.Time;
import com.oracle.svm.core.util.TimeUtils;

import jdk.graal.compiler.word.Word;

/**
* Support for POSIX global timer (see {@link PosixSubstrateSigprofHandler}).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.oracle.svm.core.IsolateListenerSupportFeature;
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport;
import com.oracle.svm.core.jfr.HasJfrSupport;
import com.oracle.svm.core.jfr.JfrExecutionSamplerSupported;
import com.oracle.svm.core.jfr.JfrFeature;
Expand All @@ -58,6 +59,11 @@
@AutomaticallyRegisteredFeature
public class PosixSubstrateSigprofHandlerFeature implements InternalFeature {

@Override
public boolean isInConfiguration(IsInConfigurationAccess access) {
return !ImageLayerBuildingSupport.buildingImageLayer();
}

@Override
public List<Class<? extends Feature>> getRequiredFeatures() {
return List.of(ThreadListenerSupportFeature.class, IsolateListenerSupportFeature.class, JfrFeature.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,15 @@
import com.oracle.svm.core.posix.headers.Stdlib;
import com.oracle.svm.core.posix.headers.Unistd;
import com.oracle.svm.core.posix.headers.darwin.Foundation;
import com.oracle.svm.core.traits.BuiltinTraits.AllAccess;
import com.oracle.svm.core.traits.BuiltinTraits.BuildtimeAccessOnly;
import com.oracle.svm.core.traits.BuiltinTraits.NoLayeredCallbacks;
import com.oracle.svm.core.traits.SingletonLayeredInstallationKind.Disallowed;
import com.oracle.svm.core.traits.SingletonTraits;

import jdk.graal.compiler.word.Word;

@SingletonTraits(access = AllAccess.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
@CLibrary(value = "darwin", requireStatic = true)
public class DarwinSystemPropertiesSupport extends PosixSystemPropertiesSupport {

Expand Down Expand Up @@ -128,6 +134,7 @@ protected String osVersionValue() {
}
}

@SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = NoLayeredCallbacks.class, layeredInstallationKind = Disallowed.class)
@AutomaticallyRegisteredFeature
class DarwinSystemPropertiesFeature implements InternalFeature {
@Override
Expand Down
Loading