Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @ 10750:9f5a4074e36b
test for nullness and disjunctive conditions in ConditionalEliminationPhase
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 15 Jul 2013 13:36:59 +0200 |
parents | e522a00b91aa |
children | 3cce976666d9 |
rev | line source |
---|---|
0 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6801
diff
changeset
|
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
25 import java.io.FileWriter; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
26 import java.io.IOException; |
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
27 import java.io.PrintWriter; |
6801 | 28 import java.nio.file.FileSystems; |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
29 import java.util.Vector; |
0 | 30 |
31 public class WinGammaPlatformVC7 extends WinGammaPlatform { | |
32 | |
6801 | 33 // TODO How about moving all globals configs to its own BuildConfig? |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
34 |
6801 | 35 String projectVersion() { |
36 return "7.10"; | |
37 }; | |
0 | 38 |
6801 | 39 public void writeProjectFile(String projectFileName, String projectName, |
40 Vector<BuildConfig> allConfigs) throws IOException { | |
41 System.out.println(); | |
42 System.out.println(" Writing .vcproj file: " + projectFileName); | |
43 // If we got this far without an error, we're safe to actually | |
44 // write the .vcproj file | |
45 printWriter = new PrintWriter(new FileWriter(projectFileName)); | |
0 | 46 |
6801 | 47 printWriter |
48 .println("<?xml version=\"1.0\" encoding=\"windows-1251\"?>"); | |
49 startTag("VisualStudioProject", new String[] { "ProjectType", | |
50 "Visual C++", "Version", projectVersion(), "Name", projectName, | |
51 "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}", | |
52 "SccProjectName", "", "SccLocalPath", "" }); | |
53 startTag("Platforms"); | |
54 tag("Platform", | |
55 new String[] { "Name", | |
56 (String) BuildConfig.getField(null, "PlatformName") }); | |
57 endTag(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
58 |
6801 | 59 startTag("Configurations"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
60 |
6801 | 61 for (BuildConfig cfg : allConfigs) { |
62 writeConfiguration(cfg); | |
63 } | |
0 | 64 |
6801 | 65 endTag(); |
0 | 66 |
6801 | 67 tag("References"); |
0 | 68 |
6801 | 69 writeFiles(allConfigs); |
0 | 70 |
6801 | 71 tag("Globals"); |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
72 |
6801 | 73 endTag(); |
74 printWriter.close(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
75 |
6801 | 76 System.out.println(" Done."); |
77 } | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
78 |
6801 | 79 void writeCustomToolConfig(Vector<BuildConfig> configs, String[] customToolAttrs) { |
80 for (BuildConfig cfg : configs) { | |
81 startTag("FileConfiguration", | |
82 new String[] { "Name", (String) cfg.get("Name") }); | |
83 tag("Tool", customToolAttrs); | |
0 | 84 |
6801 | 85 endTag(); |
86 } | |
87 } | |
0 | 88 |
6801 | 89 void writeFiles(Vector<BuildConfig> allConfigs) { |
0 | 90 |
6801 | 91 // This code assummes there are no config specific includes. |
92 startTag("Files"); | |
93 String sourceBase = BuildConfig.getFieldString(null, "SourceBase"); | |
0 | 94 |
6801 | 95 // Use first config for all global absolute includes. |
96 BuildConfig baseConfig = allConfigs.firstElement(); | |
97 Vector<String> rv = new Vector<String>(); | |
1972 | 98 |
6801 | 99 // Then use first config for all relative includes |
100 Vector<String> ri = new Vector<String>(); | |
101 baseConfig.collectRelevantVectors(ri, "RelativeSrcInclude"); | |
102 for (String f : ri) { | |
103 rv.add(sourceBase + Util.sep + f); | |
104 } | |
1972 | 105 |
6801 | 106 baseConfig.collectRelevantVectors(rv, "AbsoluteSrcInclude"); |
0 | 107 |
6801 | 108 handleIncludes(rv, allConfigs); |
0 | 109 |
6801 | 110 startTag("Filter", new String[] { "Name", "Resource Files", "Filter", |
111 "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" }); | |
112 endTag(); | |
0 | 113 |
6801 | 114 endTag(); |
115 } | |
0 | 116 |
6801 | 117 // Will visit file tree for each include |
118 private void handleIncludes(Vector<String> includes, Vector<BuildConfig> allConfigs) { | |
119 for (String path : includes) { | |
120 FileTreeCreatorVC7 ftc = new FileTreeCreatorVC7(FileSystems.getDefault().getPath(path) , allConfigs, this); | |
121 try { | |
122 ftc.writeFileTree(); | |
123 } catch (IOException e) { | |
124 e.printStackTrace(); | |
125 } | |
126 } | |
127 } | |
0 | 128 |
6801 | 129 void writeConfiguration(BuildConfig cfg) { |
130 startTag("Configuration", new String[] { "Name", cfg.get("Name"), | |
131 "OutputDirectory", cfg.get("OutputDir"), | |
132 "IntermediateDirectory", cfg.get("OutputDir"), | |
133 "ConfigurationType", "2", "UseOfMFC", "0", | |
134 "ATLMinimizesCRunTimeLibraryUsage", "FALSE" }); | |
0 | 135 |
6801 | 136 tagV("Tool", cfg.getV("CompilerFlags")); |
0 | 137 |
6801 | 138 tag("Tool", new String[] { "Name", "VCCustomBuildTool" }); |
0 | 139 |
6801 | 140 tagV("Tool", cfg.getV("LinkerFlags")); |
0 | 141 |
6801 | 142 tag("Tool", |
143 new String[] { | |
144 "Name", | |
145 "VCPostBuildEventTool", | |
146 "Description", | |
147 BuildConfig | |
148 .getFieldString(null, "PostbuildDescription"), | |
149 // Caution: String.replace(String,String) is available | |
150 // from JDK5 onwards only | |
151 "CommandLine", | |
152 cfg.expandFormat(BuildConfig.getFieldString(null, | |
153 "PostbuildCommand").replace("\t", | |
154 "
")) }); | |
0 | 155 |
6801 | 156 tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); |
0 | 157 |
6801 | 158 tag("Tool", |
159 new String[] { | |
160 "Name", | |
161 "VCPreLinkEventTool", | |
162 "Description", | |
163 BuildConfig.getFieldString(null, "PrelinkDescription"), | |
164 // Caution: String.replace(String,String) is available | |
165 // from JDK5 onwards only | |
166 "CommandLine", | |
167 cfg.expandFormat(BuildConfig.getFieldString(null, | |
168 "PrelinkCommand").replace("\t", "
")) }); | |
0 | 169 |
6801 | 170 tag("Tool", new String[] { "Name", "VCResourceCompilerTool", |
171 "PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); | |
0 | 172 |
6801 | 173 tag("Tool", new String[] { "Name", "VCMIDLTool", |
174 "PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", | |
175 "TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", | |
176 "1", "TypeLibraryName", | |
177 cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", | |
178 "" }); | |
0 | 179 |
6801 | 180 endTag(); |
181 } | |
0 | 182 |
183 | |
184 | |
6801 | 185 protected String getProjectExt() { |
186 return ".vcproj"; | |
187 } | |
0 | 188 } |
189 | |
190 class CompilerInterfaceVC7 extends CompilerInterface { | |
6801 | 191 void getBaseCompilerFlags_common(Vector defines, Vector includes, |
192 String outDir, Vector rv) { | |
0 | 193 |
6801 | 194 // advanced M$ IDE (2003) can only recognize name if it's first or |
195 // second attribute in the tag - go guess | |
196 addAttr(rv, "Name", "VCCLCompilerTool"); | |
197 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); | |
198 addAttr(rv, "PreprocessorDefinitions", | |
199 Util.join(";", defines).replace("\"", """)); | |
200 addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); | |
201 addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); | |
202 addAttr(rv, "AssemblerListingLocation", outDir); | |
203 addAttr(rv, "ObjectFile", outDir + Util.sep); | |
204 addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); | |
205 // Set /nologo optin | |
206 addAttr(rv, "SuppressStartupBanner", "TRUE"); | |
207 // Surpass the default /Tc or /Tp. 0 is compileAsDefault | |
208 addAttr(rv, "CompileAs", "0"); | |
209 // Set /W3 option. 3 is warningLevel_3 | |
210 addAttr(rv, "WarningLevel", "3"); | |
211 // Set /WX option, | |
212 addAttr(rv, "WarnAsError", "TRUE"); | |
213 // Set /GS option | |
214 addAttr(rv, "BufferSecurityCheck", "FALSE"); | |
215 // Set /Zi option. 3 is debugEnabled | |
216 addAttr(rv, "DebugInformationFormat", "3"); | |
217 } | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
218 |
6801 | 219 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { |
220 Vector rv = new Vector(); | |
0 | 221 |
6801 | 222 getBaseCompilerFlags_common(defines, includes, outDir, rv); |
223 // Set /Yu option. 3 is pchUseUsingSpecific | |
224 // Note: Starting VC8 pchUseUsingSpecific is 2 !!! | |
225 addAttr(rv, "UsePrecompiledHeader", "3"); | |
226 // Set /EHsc- option | |
227 addAttr(rv, "ExceptionHandling", "FALSE"); | |
0 | 228 |
6801 | 229 return rv; |
230 } | |
231 | |
232 Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { | |
233 Vector rv = new Vector(); | |
0 | 234 |
6801 | 235 addAttr(rv, "Name", "VCLinkerTool"); |
236 addAttr(rv, "AdditionalOptions", | |
237 "/export:JNI_GetDefaultJavaVMInitArgs " | |
238 + "/export:JNI_CreateJavaVM " | |
239 + "/export:JVM_FindClassFromBootLoader " | |
240 + "/export:JNI_GetCreatedJavaVMs " | |
241 + "/export:jio_snprintf /export:jio_printf " | |
242 + "/export:jio_fprintf /export:jio_vfprintf " | |
243 + "/export:jio_vsnprintf " | |
244 + "/export:JVM_GetVersionInfo " | |
245 + "/export:JVM_GetThreadStateNames " | |
246 + "/export:JVM_GetThreadStateValues " | |
247 + "/export:JVM_InitAgentProperties "); | |
248 addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); | |
249 addAttr(rv, "OutputFile", outDll); | |
250 // Set /INCREMENTAL option. 1 is linkIncrementalNo | |
251 addAttr(rv, "LinkIncremental", "1"); | |
252 addAttr(rv, "SuppressStartupBanner", "TRUE"); | |
253 addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); | |
254 addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); | |
255 // Set /SUBSYSTEM option. 2 is subSystemWindows | |
256 addAttr(rv, "SubSystem", "2"); | |
257 addAttr(rv, "BaseAddress", "0x8000000"); | |
258 addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); | |
259 if (platformName.equals("Win32")) { | |
260 // Set /MACHINE option. 1 is X86 | |
261 addAttr(rv, "TargetMachine", "1"); | |
262 } else { | |
263 // Set /MACHINE option. 17 is X64 | |
264 addAttr(rv, "TargetMachine", "17"); | |
265 } | |
0 | 266 |
6801 | 267 return rv; |
268 } | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
269 |
6801 | 270 void getDebugCompilerFlags_common(String opt, Vector rv) { |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
271 |
6801 | 272 // Set /On option |
273 addAttr(rv, "Optimization", opt); | |
274 // Set /FR option. 1 is brAllInfo | |
275 addAttr(rv, "BrowseInformation", "1"); | |
276 addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); | |
277 // Set /MD option. 2 is rtMultiThreadedDLL | |
278 addAttr(rv, "RuntimeLibrary", "2"); | |
279 // Set /Oy- option | |
280 addAttr(rv, "OmitFramePointers", "FALSE"); | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
281 |
6801 | 282 } |
283 | |
284 Vector getDebugCompilerFlags(String opt) { | |
285 Vector rv = new Vector(); | |
0 | 286 |
6801 | 287 getDebugCompilerFlags_common(opt, rv); |
0 | 288 |
6801 | 289 return rv; |
290 } | |
0 | 291 |
6801 | 292 Vector getDebugLinkerFlags() { |
293 Vector rv = new Vector(); | |
0 | 294 |
6801 | 295 addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option |
0 | 296 |
6801 | 297 return rv; |
298 } | |
299 | |
300 void getAdditionalNonKernelLinkerFlags(Vector rv) { | |
301 extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); | |
302 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
303 |
6801 | 304 void getProductCompilerFlags_common(Vector rv) { |
305 // Set /O2 option. 2 is optimizeMaxSpeed | |
306 addAttr(rv, "Optimization", "2"); | |
307 // Set /Oy- option | |
308 addAttr(rv, "OmitFramePointers", "FALSE"); | |
309 // Set /Ob option. 1 is expandOnlyInline | |
310 addAttr(rv, "InlineFunctionExpansion", "1"); | |
311 // Set /GF option. | |
312 addAttr(rv, "StringPooling", "TRUE"); | |
313 // Set /MD option. 2 is rtMultiThreadedDLL | |
314 addAttr(rv, "RuntimeLibrary", "2"); | |
315 // Set /Gy option | |
316 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); | |
317 } | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
318 |
6801 | 319 Vector getProductCompilerFlags() { |
320 Vector rv = new Vector(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
321 |
6801 | 322 getProductCompilerFlags_common(rv); |
0 | 323 |
6801 | 324 return rv; |
325 } | |
0 | 326 |
6801 | 327 Vector getProductLinkerFlags() { |
328 Vector rv = new Vector(); | |
0 | 329 |
6801 | 330 // Set /OPT:REF option. 2 is optReferences |
331 addAttr(rv, "OptimizeReferences", "2"); | |
332 // Set /OPT:optFolding option. 2 is optFolding | |
333 addAttr(rv, "EnableCOMDATFolding", "2"); | |
0 | 334 |
6801 | 335 return rv; |
336 } | |
0 | 337 |
6801 | 338 String getOptFlag() { |
339 return "2"; | |
340 } | |
0 | 341 |
6801 | 342 String getNoOptFlag() { |
343 return "0"; | |
344 } | |
0 | 345 |
6801 | 346 String makeCfgName(String flavourBuild, String platform) { |
347 return flavourBuild + "|" + platform; | |
348 } | |
349 | |
0 | 350 } |