Search in sources :

Example 1 with Architecture

use of jdk.vm.ci.code.Architecture in project graal by oracle.

the class SPARCAssemblerTest method createTarget.

private static TargetDescription createTarget() {
    final int stackFrameAlignment = 16;
    final int implicitNullCheckLimit = 4096;
    final boolean inlineObjects = true;
    Architecture arch = new SPARC(computeFeatures());
    return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
Also used : SPARC(jdk.vm.ci.sparc.SPARC) Architecture(jdk.vm.ci.code.Architecture) TargetDescription(jdk.vm.ci.code.TargetDescription)

Example 2 with Architecture

use of jdk.vm.ci.code.Architecture in project graal by oracle.

the class NativeImageGenerator method createTarget.

public static TargetDescription createTarget(Platform platform) {
    if (includedIn(platform, Platform.AMD64.class)) {
        Architecture architecture;
        if (NativeImageOptions.NativeArchitecture.getValue()) {
            architecture = GraalAccess.getOriginalTarget().arch;
        } else {
            EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
            // SSE and SSE2 are added by defaults as they are required by Graal
            features.add(AMD64.CPUFeature.SSE);
            features.add(AMD64.CPUFeature.SSE2);
            features.addAll(parseCSVtoEnum(AMD64.CPUFeature.class, NativeImageOptions.CPUFeatures.getValue()));
            architecture = new AMD64(features, SubstrateTargetDescription.allFlags());
        }
        assert architecture instanceof AMD64 : "SVM supports only AMD64 architectures.";
        return new SubstrateTargetDescription(architecture, true, 16, 0, false);
    } else {
        throw UserError.abort("Architecture specified by platform is not supported: " + platform.getClass().getTypeName());
    }
}
Also used : AMD64(jdk.vm.ci.amd64.AMD64) Platform(org.graalvm.nativeimage.Platform) Architecture(jdk.vm.ci.code.Architecture) SubstrateTargetDescription(com.oracle.svm.core.graal.meta.SubstrateTargetDescription)

Example 3 with Architecture

use of jdk.vm.ci.code.Architecture in project graal by oracle.

the class BitOpNodesTest method testBitCountLong.

@Test
public void testBitCountLong() {
    Architecture arch = getBackend().getTarget().arch;
    boolean isAmd64WithPopCount = arch instanceof AMD64 && ((AMD64) arch).getFeatures().contains(AMD64.CPUFeature.POPCNT);
    boolean isSparc = arch instanceof SPARC;
    Assume.assumeTrue("Only works on hardware with popcnt at the moment", isAmd64WithPopCount || isSparc);
    ValueNode result = parseAndInline("bitCountLongSnippet");
    Assert.assertEquals(StampFactory.forInteger(JavaKind.Int, 8, 40), result.stamp(NodeView.DEFAULT));
}
Also used : AMD64(jdk.vm.ci.amd64.AMD64) SPARC(jdk.vm.ci.sparc.SPARC) Architecture(jdk.vm.ci.code.Architecture) ValueNode(org.graalvm.compiler.nodes.ValueNode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 4 with Architecture

use of jdk.vm.ci.code.Architecture in project graal by oracle.

the class AArch64MacroAssemblerTest method createTarget.

private static TargetDescription createTarget() {
    final int stackFrameAlignment = 16;
    final int implicitNullCheckLimit = 4096;
    final boolean inlineObjects = true;
    Architecture arch = new AArch64(computeFeatures(), computeFlags());
    return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
Also used : AArch64(jdk.vm.ci.aarch64.AArch64) Architecture(jdk.vm.ci.code.Architecture) TargetDescription(jdk.vm.ci.code.TargetDescription)

Example 5 with Architecture

use of jdk.vm.ci.code.Architecture in project graal by oracle.

the class JavaMainWrapper method run.

@CEntryPoint
@CEntryPointOptions(prologue = EnterCreateIsolatePrologue.class, include = CEntryPointOptions.NotIncludedAutomatically.class)
public static int run(int paramArgc, CCharPointerPointer paramArgv) throws Exception {
    JavaThreads.singleton().assignJavaThread(preallocatedThread, true);
    JavaMainWrapper.argc = paramArgc;
    JavaMainWrapper.argv = paramArgv;
    Architecture imageArchitecture = ImageSingletons.lookup(TargetDescription.class).arch;
    AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(imageArchitecture);
    String[] args = SubstrateUtil.getArgs(paramArgc, paramArgv);
    if (SubstrateOptions.ParseRuntimeOptions.getValue()) {
        args = RuntimeOptionParser.singleton().parse(args, DEFAULT_OPTION_PREFIX, PLUS_MINUS, true);
        args = RuntimeOptionParser.singleton().parse(args, GRAAL_OPTION_PREFIX, NAME_VALUE, true);
        args = XOptions.singleton().parse(args);
        args = RuntimePropertyParser.parse(args);
    }
    mainArgs = args;
    try {
        final RuntimeSupport rs = RuntimeSupport.getRuntimeSupport();
        if (AllocationSite.Options.AllocationProfiling.getValue()) {
            rs.addShutdownHook(new AllocationSite.AllocationProfilingShutdownHook());
        }
        if (SubstrateOptions.PrintGCSummary.getValue()) {
            rs.addShutdownHook(new PrintGCSummaryShutdownHook());
        }
        try {
            JavaMainSupport.executeStartupHooks();
            ImageSingletons.lookup(JavaMainSupport.class).getJavaMainMethod().invoke(null, (Object) mainArgs);
        } finally {
            // always execute the shutdown hooks
            JavaMainSupport.executeShutdownHooks();
        }
    } catch (Throwable ex) {
        SnippetRuntime.reportUnhandledExceptionJava(ex);
    }
    JavaThreads.singleton().joinAllNonDaemons();
    Counter.logValues();
    return 0;
}
Also used : RuntimeSupport(com.oracle.svm.core.jdk.RuntimeSupport) Architecture(jdk.vm.ci.code.Architecture) TargetDescription(jdk.vm.ci.code.TargetDescription) AllocationSite(com.oracle.svm.core.allocationprofile.AllocationSite) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

Architecture (jdk.vm.ci.code.Architecture)8 AMD64 (jdk.vm.ci.amd64.AMD64)5 SPARC (jdk.vm.ci.sparc.SPARC)5 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)4 ValueNode (org.graalvm.compiler.nodes.ValueNode)4 Test (org.junit.Test)4 TargetDescription (jdk.vm.ci.code.TargetDescription)3 AllocationSite (com.oracle.svm.core.allocationprofile.AllocationSite)1 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)1 SubstrateTargetDescription (com.oracle.svm.core.graal.meta.SubstrateTargetDescription)1 RuntimeSupport (com.oracle.svm.core.jdk.RuntimeSupport)1 AArch64 (jdk.vm.ci.aarch64.AArch64)1 Platform (org.graalvm.nativeimage.Platform)1 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)1