annotate graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java @ 13137:438ed35bed29

Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 22 Nov 2013 15:32:20 -0800
parents bba234a1670e
children f4f0a8a01ce0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.phases.tiers;
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
24
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
25 import com.oracle.graal.api.code.*;
13137
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
26 import com.oracle.graal.api.meta.*;
9265
bff0abdbc8b6 Restructure phase context hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 9048
diff changeset
27 import com.oracle.graal.nodes.spi.*;
10931
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
28 import com.oracle.graal.phases.*;
12054
bba234a1670e grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
29 import com.oracle.graal.phases.util.*;
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
30
9048
5ca15f09106c Base class for phase context.
Roland Schatz <roland.schatz@oracle.com>
parents: 9001
diff changeset
31 public class HighTierContext extends PhaseContext {
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
32
10931
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
33 private final PhasePlan plan;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
34
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
35 private final GraphCache cache;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
36 private final OptimisticOptimizations optimisticOpts;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
37
13137
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
38 public HighTierContext(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, LoweringProvider lowerer, Replacements replacements, Assumptions assumptions,
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
39 GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) {
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
40 super(metaAccess, constantReflection, lowerer, replacements, assumptions);
10931
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
41 this.plan = plan;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
42 this.cache = cache;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
43 this.optimisticOpts = optimisticOpts;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
44 }
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
45
13137
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
46 public HighTierContext(Providers providers, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) {
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
47 this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getLowerer(), providers.getReplacements(), assumptions, cache, plan, optimisticOpts);
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
48 }
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
49
10931
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
50 public PhasePlan getPhasePlan() {
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
51 return plan;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
52 }
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
53
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
54 public GraphCache getGraphCache() {
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
55 return cache;
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
56 }
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
57
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
58 public OptimisticOptimizations getOptimisticOptimizations() {
a9db73ccb7b9 Add more fields to HighTierContext.
Roland Schatz <roland.schatz@oracle.com>
parents: 9916
diff changeset
59 return optimisticOpts;
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
60 }
11567
c69df2e602f4 Use CanonicalizerPhase.applyIncremental in InliningPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 10931
diff changeset
61
c69df2e602f4 Use CanonicalizerPhase.applyIncremental in InliningPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 10931
diff changeset
62 public HighTierContext replaceAssumptions(Assumptions newAssumptions) {
13137
438ed35bed29 Change PhaseContext so that it does not subclass Providers, to avoid leaking low-level provider objects such as the CodeCacheProvdier to high-level optimization phases
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12054
diff changeset
63 return new HighTierContext(getMetaAccess(), getConstantReflection(), getLowerer(), getReplacements(), newAssumptions, getGraphCache(), getPhasePlan(), getOptimisticOptimizations());
11567
c69df2e602f4 Use CanonicalizerPhase.applyIncremental in InliningPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 10931
diff changeset
64 }
9001
94583d9eead8 HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
65 }