Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java @ 23679:b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 15 Jun 2016 00:00:41 +0200 |
parents | 9ed5b586018b |
children | 71becd3e2b1f |
comparison
equal
deleted
inserted
replaced
23678:e86a0b0ba969 | 23679:b5557b757040 |
---|---|
35 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; | 35 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider; |
36 import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; | 36 import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; |
37 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; | 37 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; |
38 import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; | 38 import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; |
39 import jdk.vm.ci.hotspot.HotSpotStackIntrospection; | 39 import jdk.vm.ci.hotspot.HotSpotStackIntrospection; |
40 import jdk.vm.ci.hotspot.HotSpotVMConfig; | |
41 import jdk.vm.ci.runtime.JVMCIBackend; | 40 import jdk.vm.ci.runtime.JVMCIBackend; |
42 import jdk.vm.ci.sparc.SPARC; | 41 import jdk.vm.ci.sparc.SPARC; |
43 import jdk.vm.ci.sparc.SPARC.CPUFeature; | 42 import jdk.vm.ci.sparc.SPARC.CPUFeature; |
44 | 43 |
45 public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { | 44 public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { |
46 | 45 |
47 protected TargetDescription createTarget(HotSpotVMConfig config) { | 46 protected TargetDescription createTarget(SPARCHotSpotVMConfig config) { |
48 final int stackFrameAlignment = 16; | 47 final int stackFrameAlignment = 16; |
49 final int implicitNullCheckLimit = 4096; | 48 final int implicitNullCheckLimit = 4096; |
50 final boolean inlineObjects = false; | 49 final boolean inlineObjects = false; |
51 Architecture arch = new SPARC(computeFeatures(config)); | 50 Architecture arch = new SPARC(computeFeatures(config)); |
52 return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects); | 51 return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects); |
54 | 53 |
55 protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { | 54 protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { |
56 return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); | 55 return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); |
57 } | 56 } |
58 | 57 |
59 protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) { | 58 protected EnumSet<CPUFeature> computeFeatures(SPARCHotSpotVMConfig config) { |
60 EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class); | 59 EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class); |
61 if ((config.sparcFeatures & config.vis1Instructions) != 0) { | 60 if ((config.vmVersionFeatures & config.sparcVis1Instructions) != 0) { |
62 features.add(CPUFeature.VIS1); | 61 features.add(CPUFeature.VIS1); |
63 } | 62 } |
64 if ((config.sparcFeatures & config.vis2Instructions) != 0) { | 63 if ((config.vmVersionFeatures & config.sparcVis2Instructions) != 0) { |
65 features.add(CPUFeature.VIS2); | 64 features.add(CPUFeature.VIS2); |
66 } | 65 } |
67 if ((config.sparcFeatures & config.vis3Instructions) != 0) { | 66 if ((config.vmVersionFeatures & config.sparcVis3Instructions) != 0) { |
68 features.add(CPUFeature.VIS3); | 67 features.add(CPUFeature.VIS3); |
69 } | 68 } |
70 if ((config.sparcFeatures & config.cbcondInstructions) != 0) { | 69 if ((config.vmVersionFeatures & config.sparcCbcondInstructions) != 0) { |
71 features.add(CPUFeature.CBCOND); | 70 features.add(CPUFeature.CBCOND); |
72 } | 71 } |
73 if ((config.sparcFeatures & config.v8Instructions) != 0) { | 72 if ((config.vmVersionFeatures & config.sparcV8Instructions) != 0) { |
74 features.add(CPUFeature.V8); | 73 features.add(CPUFeature.V8); |
75 } | 74 } |
76 if ((config.sparcFeatures & config.hardwareMul32) != 0) { | 75 if ((config.vmVersionFeatures & config.sparcHardwareMul32) != 0) { |
77 features.add(CPUFeature.HARDWARE_MUL32); | 76 features.add(CPUFeature.HARDWARE_MUL32); |
78 } | 77 } |
79 if ((config.sparcFeatures & config.hardwareDiv32) != 0) { | 78 if ((config.vmVersionFeatures & config.sparcHardwareDiv32) != 0) { |
80 features.add(CPUFeature.HARDWARE_DIV32); | 79 features.add(CPUFeature.HARDWARE_DIV32); |
81 } | 80 } |
82 if ((config.sparcFeatures & config.hardwareFsmuld) != 0) { | 81 if ((config.vmVersionFeatures & config.sparcHardwareFsmuld) != 0) { |
83 features.add(CPUFeature.HARDWARE_FSMULD); | 82 features.add(CPUFeature.HARDWARE_FSMULD); |
84 } | 83 } |
85 if ((config.sparcFeatures & config.hardwarePopc) != 0) { | 84 if ((config.vmVersionFeatures & config.sparcHardwarePopc) != 0) { |
86 features.add(CPUFeature.HARDWARE_POPC); | 85 features.add(CPUFeature.HARDWARE_POPC); |
87 } | 86 } |
88 if ((config.sparcFeatures & config.v9Instructions) != 0) { | 87 if ((config.vmVersionFeatures & config.sparcV9Instructions) != 0) { |
89 features.add(CPUFeature.V9); | 88 features.add(CPUFeature.V9); |
90 } | 89 } |
91 if ((config.sparcFeatures & config.sun4v) != 0) { | 90 if ((config.vmVersionFeatures & config.sparcSun4v) != 0) { |
92 features.add(CPUFeature.SUN4V); | 91 features.add(CPUFeature.SUN4V); |
93 } | 92 } |
94 if ((config.sparcFeatures & config.blkInitInstructions) != 0) { | 93 if ((config.vmVersionFeatures & config.sparcBlkInitInstructions) != 0) { |
95 features.add(CPUFeature.BLK_INIT_INSTRUCTIONS); | 94 features.add(CPUFeature.BLK_INIT_INSTRUCTIONS); |
96 } | 95 } |
97 if ((config.sparcFeatures & config.fmafInstructions) != 0) { | 96 if ((config.vmVersionFeatures & config.sparcFmafInstructions) != 0) { |
98 features.add(CPUFeature.FMAF); | 97 features.add(CPUFeature.FMAF); |
99 } | 98 } |
100 if ((config.sparcFeatures & config.fmauInstructions) != 0) { | 99 if ((config.vmVersionFeatures & config.sparcFmauInstructions) != 0) { |
101 features.add(CPUFeature.FMAU); | 100 features.add(CPUFeature.FMAU); |
102 } | 101 } |
103 if ((config.sparcFeatures & config.sparc64Family) != 0) { | 102 if ((config.vmVersionFeatures & config.sparcSparc64Family) != 0) { |
104 features.add(CPUFeature.SPARC64_FAMILY); | 103 features.add(CPUFeature.SPARC64_FAMILY); |
105 } | 104 } |
106 if ((config.sparcFeatures & config.mFamily) != 0) { | 105 if ((config.vmVersionFeatures & config.sparcMFamily) != 0) { |
107 features.add(CPUFeature.M_FAMILY); | 106 features.add(CPUFeature.M_FAMILY); |
108 } | 107 } |
109 if ((config.sparcFeatures & config.tFamily) != 0) { | 108 if ((config.vmVersionFeatures & config.sparcTFamily) != 0) { |
110 features.add(CPUFeature.T_FAMILY); | 109 features.add(CPUFeature.T_FAMILY); |
111 } | 110 } |
112 if ((config.sparcFeatures & config.t1Model) != 0) { | 111 if ((config.vmVersionFeatures & config.sparcT1Model) != 0) { |
113 features.add(CPUFeature.T1_MODEL); | 112 features.add(CPUFeature.T1_MODEL); |
114 } | 113 } |
115 if ((config.sparcFeatures & config.sparc5Instructions) != 0) { | 114 if ((config.vmVersionFeatures & config.sparcSparc5Instructions) != 0) { |
116 features.add(CPUFeature.SPARC5); | 115 features.add(CPUFeature.SPARC5); |
117 } | 116 } |
118 if ((config.sparcFeatures & config.aesInstructions) != 0) { | 117 if ((config.vmVersionFeatures & config.sparcAesInstructions) != 0) { |
119 features.add(CPUFeature.SPARC64_FAMILY); | 118 features.add(CPUFeature.SPARC64_FAMILY); |
120 } | 119 } |
121 if ((config.sparcFeatures & config.sha1Instruction) != 0) { | 120 if ((config.vmVersionFeatures & config.sparcSha1Instruction) != 0) { |
122 features.add(CPUFeature.SHA1); | 121 features.add(CPUFeature.SHA1); |
123 } | 122 } |
124 if ((config.sparcFeatures & config.sha256Instruction) != 0) { | 123 if ((config.vmVersionFeatures & config.sparcSha256Instruction) != 0) { |
125 features.add(CPUFeature.SHA256); | 124 features.add(CPUFeature.SHA256); |
126 } | 125 } |
127 if ((config.sparcFeatures & config.sha512Instruction) != 0) { | 126 if ((config.vmVersionFeatures & config.sparcSha512Instruction) != 0) { |
128 features.add(CPUFeature.SHA512); | 127 features.add(CPUFeature.SHA512); |
129 } | 128 } |
130 return features; | 129 return features; |
131 } | 130 } |
132 | 131 |
141 } | 140 } |
142 | 141 |
143 @SuppressWarnings("try") | 142 @SuppressWarnings("try") |
144 public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { | 143 public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { |
145 assert host == null; | 144 assert host == null; |
146 TargetDescription target = createTarget(runtime.getConfig()); | 145 SPARCHotSpotVMConfig config = new SPARCHotSpotVMConfig(runtime.getConfigStore()); |
146 TargetDescription target = createTarget(config); | |
147 | 147 |
148 HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime); | 148 HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime); |
149 RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig()); | 149 RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, config.useCompressedOops, config.linuxOs); |
150 HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig); | 150 HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig); |
151 HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime); | 151 HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime); |
152 StackIntrospection stackIntrospection = new HotSpotStackIntrospection(runtime); | 152 StackIntrospection stackIntrospection = new HotSpotStackIntrospection(runtime); |
153 try (InitTimer rt = timer("instantiate backend")) { | 153 try (InitTimer rt = timer("instantiate backend")) { |
154 return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection); | 154 return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection); |