Mercurial > hg > truffle
comparison graal/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java @ 21687:afea1d08c393
Merge with df4579cb9503128c646bd04e66646ccfa7faf25f
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 02 Jun 2015 18:32:11 -0700 |
parents | 2e8c01def9a5 |
children |
comparison
equal
deleted
inserted
replaced
21686:5fa7935c5de3 | 21687:afea1d08c393 |
---|---|
1 /* | |
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.jvmci.hotspot.sparc; | |
24 | |
25 import static com.oracle.jvmci.hotspot.InitTimer.*; | |
26 | |
27 import java.util.*; | |
28 | |
29 import com.oracle.jvmci.code.*; | |
30 import com.oracle.jvmci.hotspot.*; | |
31 import com.oracle.jvmci.runtime.*; | |
32 import com.oracle.jvmci.service.*; | |
33 import com.oracle.jvmci.sparc.*; | |
34 import com.oracle.jvmci.sparc.SPARC.CPUFeature; | |
35 | |
36 @ServiceProvider(HotSpotJVMCIBackendFactory.class) | |
37 public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { | |
38 | |
39 protected Architecture createArchitecture(HotSpotVMConfig config) { | |
40 return new SPARC(computeFeatures(config)); | |
41 } | |
42 | |
43 protected TargetDescription createTarget(HotSpotVMConfig config) { | |
44 final int stackFrameAlignment = 16; | |
45 final int implicitNullCheckLimit = 4096; | |
46 final boolean inlineObjects = true; | |
47 return new HotSpotTargetDescription(createArchitecture(config), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects); | |
48 } | |
49 | |
50 protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { | |
51 return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); | |
52 } | |
53 | |
54 protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) { | |
55 EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class); | |
56 if ((config.sparcFeatures & config.vis1Instructions) != 0) { | |
57 features.add(CPUFeature.VIS1); | |
58 } | |
59 if ((config.sparcFeatures & config.vis2Instructions) != 0) { | |
60 features.add(CPUFeature.VIS2); | |
61 } | |
62 if ((config.sparcFeatures & config.vis3Instructions) != 0) { | |
63 features.add(CPUFeature.VIS3); | |
64 } | |
65 if ((config.sparcFeatures & config.cbcondInstructions) != 0) { | |
66 features.add(CPUFeature.CBCOND); | |
67 } | |
68 return features; | |
69 } | |
70 | |
71 public String getArchitecture() { | |
72 return "SPARC"; | |
73 } | |
74 | |
75 @Override | |
76 public String toString() { | |
77 return getJVMCIRuntimeName() + ":" + getArchitecture(); | |
78 } | |
79 | |
80 public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { | |
81 assert host == null; | |
82 TargetDescription target = createTarget(runtime.getConfig()); | |
83 | |
84 HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime); | |
85 RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig()); | |
86 HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig); | |
87 HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime); | |
88 try (InitTimer rt = timer("instantiate backend")) { | |
89 return createBackend(metaAccess, codeCache, constantReflection); | |
90 } | |
91 } | |
92 | |
93 protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, HotSpotConstantReflectionProvider constantReflection) { | |
94 return new JVMCIBackend(metaAccess, codeCache, constantReflection); | |
95 } | |
96 | |
97 public String getJVMCIRuntimeName() { | |
98 return "basic"; | |
99 } | |
100 } |