src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/util/Providers.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54328 37648a9c4a6a
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.
    25 package org.graalvm.compiler.phases.util;
    25 package org.graalvm.compiler.phases.util;
    26 
    26 
    27 import org.graalvm.compiler.core.common.spi.CodeGenProviders;
    27 import org.graalvm.compiler.core.common.spi.CodeGenProviders;
    28 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
    28 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
    29 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
    29 import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
       
    30 import org.graalvm.compiler.nodes.spi.CoreProviders;
    30 import org.graalvm.compiler.nodes.spi.CoreProvidersImpl;
    31 import org.graalvm.compiler.nodes.spi.CoreProvidersImpl;
       
    32 import org.graalvm.compiler.nodes.spi.GCProvider;
    31 import org.graalvm.compiler.nodes.spi.LoweringProvider;
    33 import org.graalvm.compiler.nodes.spi.LoweringProvider;
    32 import org.graalvm.compiler.nodes.spi.Replacements;
    34 import org.graalvm.compiler.nodes.spi.Replacements;
    33 import org.graalvm.compiler.nodes.spi.StampProvider;
    35 import org.graalvm.compiler.nodes.spi.StampProvider;
    34 import org.graalvm.compiler.phases.tiers.PhaseContext;
       
    35 
    36 
    36 import jdk.vm.ci.code.CodeCacheProvider;
    37 import jdk.vm.ci.code.CodeCacheProvider;
    37 import jdk.vm.ci.meta.ConstantReflectionProvider;
    38 import jdk.vm.ci.meta.ConstantReflectionProvider;
    38 import jdk.vm.ci.meta.MetaAccessProvider;
    39 import jdk.vm.ci.meta.MetaAccessProvider;
    39 
    40 
    43 public class Providers extends CoreProvidersImpl implements CodeGenProviders {
    44 public class Providers extends CoreProvidersImpl implements CodeGenProviders {
    44 
    45 
    45     private final CodeCacheProvider codeCache;
    46     private final CodeCacheProvider codeCache;
    46 
    47 
    47     public Providers(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider,
    48     public Providers(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider,
    48                     ForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, StampProvider stampProvider) {
    49                     ForeignCallsProvider foreignCalls, LoweringProvider lowerer, Replacements replacements, StampProvider stampProvider, GCProvider gc) {
    49         super(metaAccess, constantReflection, constantFieldProvider, lowerer, replacements, stampProvider, foreignCalls);
    50         super(metaAccess, constantReflection, constantFieldProvider, lowerer, replacements, stampProvider, foreignCalls, gc);
    50         this.codeCache = codeCache;
    51         this.codeCache = codeCache;
    51     }
    52     }
    52 
    53 
    53     public Providers(Providers copyFrom) {
    54     public Providers(Providers copyFrom) {
    54         this(copyFrom.getMetaAccess(), copyFrom.getCodeCache(), copyFrom.getConstantReflection(), copyFrom.getConstantFieldProvider(), copyFrom.getForeignCalls(), copyFrom.getLowerer(),
    55         this(copyFrom.getMetaAccess(), copyFrom.getCodeCache(), copyFrom.getConstantReflection(), copyFrom.getConstantFieldProvider(), copyFrom.getForeignCalls(), copyFrom.getLowerer(),
    55                         copyFrom.getReplacements(), copyFrom.getStampProvider());
    56                         copyFrom.getReplacements(), copyFrom.getStampProvider(), copyFrom.getGC());
    56     }
    57     }
    57 
    58 
    58     public Providers(PhaseContext copyFrom) {
    59     public Providers(CoreProviders copyFrom) {
    59         this(copyFrom.getMetaAccess(), null, copyFrom.getConstantReflection(), copyFrom.getConstantFieldProvider(), null, copyFrom.getLowerer(), copyFrom.getReplacements(),
    60         this(copyFrom.getMetaAccess(), null, copyFrom.getConstantReflection(), copyFrom.getConstantFieldProvider(), null, copyFrom.getLowerer(), copyFrom.getReplacements(),
    60                         copyFrom.getStampProvider());
    61                         copyFrom.getStampProvider(), copyFrom.getGC());
    61     }
    62     }
    62 
    63 
    63     @Override
    64     @Override
    64     public CodeCacheProvider getCodeCache() {
    65     public CodeCacheProvider getCodeCache() {
    65         return codeCache;
    66         return codeCache;
    66     }
    67     }
    67 
    68 
    68     public Providers copyWith(MetaAccessProvider substitution) {
    69     public Providers copyWith(MetaAccessProvider substitution) {
    69         assert this.getClass() == Providers.class : "must override";
    70         assert this.getClass() == Providers.class : "must override";
    70         return new Providers(substitution, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider);
    71         return new Providers(substitution, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, gc);
    71     }
    72     }
    72 
    73 
    73     public Providers copyWith(CodeCacheProvider substitution) {
    74     public Providers copyWith(CodeCacheProvider substitution) {
    74         assert this.getClass() == Providers.class : "must override";
    75         assert this.getClass() == Providers.class : "must override";
    75         return new Providers(metaAccess, substitution, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider);
    76         return new Providers(metaAccess, substitution, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, gc);
    76     }
    77     }
    77 
    78 
    78     public Providers copyWith(ConstantReflectionProvider substitution) {
    79     public Providers copyWith(ConstantReflectionProvider substitution) {
    79         assert this.getClass() == Providers.class : "must override";
    80         assert this.getClass() == Providers.class : "must override";
    80         return new Providers(metaAccess, codeCache, substitution, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider);
    81         return new Providers(metaAccess, codeCache, substitution, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, gc);
    81     }
    82     }
    82 
    83 
    83     public Providers copyWith(ConstantFieldProvider substitution) {
    84     public Providers copyWith(ConstantFieldProvider substitution) {
    84         assert this.getClass() == Providers.class : "must override";
    85         assert this.getClass() == Providers.class : "must override";
    85         return new Providers(metaAccess, codeCache, constantReflection, substitution, foreignCalls, lowerer, replacements, stampProvider);
    86         return new Providers(metaAccess, codeCache, constantReflection, substitution, foreignCalls, lowerer, replacements, stampProvider, gc);
    86     }
    87     }
    87 
    88 
    88     public Providers copyWith(ForeignCallsProvider substitution) {
    89     public Providers copyWith(ForeignCallsProvider substitution) {
    89         assert this.getClass() == Providers.class : "must override";
    90         assert this.getClass() == Providers.class : "must override";
    90         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, substitution, lowerer, replacements, stampProvider);
    91         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, substitution, lowerer, replacements, stampProvider, gc);
    91     }
    92     }
    92 
    93 
    93     public Providers copyWith(LoweringProvider substitution) {
    94     public Providers copyWith(LoweringProvider substitution) {
    94         assert this.getClass() == Providers.class : "must override";
    95         assert this.getClass() == Providers.class : "must override";
    95         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, substitution, replacements, stampProvider);
    96         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, substitution, replacements, stampProvider, gc);
    96     }
    97     }
    97 
    98 
    98     public Providers copyWith(Replacements substitution) {
    99     public Providers copyWith(Replacements substitution) {
    99         assert this.getClass() == Providers.class : "must override in " + getClass();
   100         assert this.getClass() == Providers.class : "must override in " + getClass();
   100         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, substitution, stampProvider);
   101         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, substitution, stampProvider, gc);
   101     }
   102     }
   102 
   103 
   103     public Providers copyWith(StampProvider substitution) {
   104     public Providers copyWith(StampProvider substitution) {
   104         assert this.getClass() == Providers.class : "must override";
   105         assert this.getClass() == Providers.class : "must override";
   105         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, substitution);
   106         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, substitution, gc);
       
   107     }
       
   108 
       
   109     public Providers copyWith(GCProvider substitution) {
       
   110         assert this.getClass() == Providers.class : "must override";
       
   111         return new Providers(metaAccess, codeCache, constantReflection, constantFieldProvider, foreignCalls, lowerer, replacements, stampProvider, substitution);
   106     }
   112     }
   107 }
   113 }