src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackendFactory.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52910 583fd71c47d6
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 
    24 
    25 package org.graalvm.compiler.hotspot;
    25 package org.graalvm.compiler.hotspot;
    26 
    26 
       
    27 import org.graalvm.compiler.bytecode.BytecodeProvider;
       
    28 import org.graalvm.compiler.hotspot.meta.HotSpotGCProvider;
       
    29 import org.graalvm.compiler.hotspot.meta.HotSpotGraalConstantFieldProvider;
       
    30 import org.graalvm.compiler.hotspot.meta.HotSpotSnippetReflectionProvider;
       
    31 import org.graalvm.compiler.hotspot.meta.HotSpotStampProvider;
       
    32 import org.graalvm.compiler.hotspot.word.HotSpotWordTypes;
    27 import org.graalvm.compiler.phases.tiers.CompilerConfiguration;
    33 import org.graalvm.compiler.phases.tiers.CompilerConfiguration;
       
    34 import org.graalvm.compiler.phases.util.Providers;
       
    35 import org.graalvm.compiler.replacements.classfile.ClassfileBytecodeProvider;
    28 
    36 
    29 import jdk.vm.ci.code.Architecture;
    37 import jdk.vm.ci.code.Architecture;
       
    38 import jdk.vm.ci.code.TargetDescription;
       
    39 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
    30 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
    40 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
       
    41 import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
    31 
    42 
    32 public interface HotSpotBackendFactory {
    43 public abstract class HotSpotBackendFactory {
       
    44 
       
    45     protected HotSpotGraalConstantFieldProvider createConstantFieldProvider(GraalHotSpotVMConfig config, HotSpotMetaAccessProvider metaAccess) {
       
    46         return new HotSpotGraalConstantFieldProvider(config, metaAccess);
       
    47     }
       
    48 
       
    49     protected HotSpotWordTypes createWordTypes(HotSpotMetaAccessProvider metaAccess, TargetDescription target) {
       
    50         return new HotSpotWordTypes(metaAccess, target.wordJavaKind);
       
    51     }
       
    52 
       
    53     protected HotSpotStampProvider createStampProvider() {
       
    54         return new HotSpotStampProvider();
       
    55     }
       
    56 
       
    57     protected HotSpotGCProvider createGCProvider(GraalHotSpotVMConfig config) {
       
    58         return new HotSpotGCProvider(config);
       
    59     }
       
    60 
       
    61     protected HotSpotReplacementsImpl createReplacements(TargetDescription target, Providers p, HotSpotSnippetReflectionProvider snippetReflection, BytecodeProvider bytecodeProvider) {
       
    62         return new HotSpotReplacementsImpl(p, snippetReflection, bytecodeProvider, target);
       
    63     }
       
    64 
       
    65     protected ClassfileBytecodeProvider createBytecodeProvider(HotSpotMetaAccessProvider metaAccess, HotSpotSnippetReflectionProvider snippetReflection) {
       
    66         return new ClassfileBytecodeProvider(metaAccess, snippetReflection);
       
    67     }
       
    68 
       
    69     protected HotSpotSnippetReflectionProvider createSnippetReflection(HotSpotGraalRuntimeProvider runtime, HotSpotConstantReflectionProvider constantReflection, HotSpotWordTypes wordTypes) {
       
    70         return new HotSpotSnippetReflectionProvider(runtime, constantReflection, wordTypes);
       
    71     }
    33 
    72 
    34     /**
    73     /**
    35      * Gets the name of this backend factory. This should not include the {@link #getArchitecture()
    74      * Gets the name of this backend factory. This should not include the {@link #getArchitecture()
    36      * architecture}. The {@link CompilerConfigurationFactory} can select alternative backends based
    75      * architecture}. The {@link CompilerConfigurationFactory} can select alternative backends based
    37      * on this name.
    76      * on this name.
    38      */
    77      */
    39     String getName();
    78     public abstract String getName();
    40 
    79 
    41     /**
    80     /**
    42      * Gets the class describing the architecture the backend created by this factory is associated
    81      * Gets the class describing the architecture the backend created by this factory is associated
    43      * with.
    82      * with.
    44      */
    83      */
    45     Class<? extends Architecture> getArchitecture();
    84     public abstract Class<? extends Architecture> getArchitecture();
    46 
    85 
    47     HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntime jvmciRuntime, HotSpotBackend host);
    86     public abstract HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, CompilerConfiguration compilerConfiguration, HotSpotJVMCIRuntime jvmciRuntime, HotSpotBackend host);
    48 }
    87 }