Mercurial > hg > truffle
annotate src/share/tools/ProjectCreator/WinGammaPlatformVC7.java @ 17895:31e28ee4c9b4
8038921: assert(t != NULL) failed: must set before get
Summary: Ignore nodes without a type when checking for speculative types in Compile::remove_speculative_types(...).
Reviewed-by: kvn, roland
Contributed-by: Tobias Hartmann <tobias.hartmann@oracle.com>
author | anoll |
---|---|
date | Wed, 23 Apr 2014 10:35:15 +0200 |
parents | 55fb97c4c58d |
children | d8041d695d19 |
rev | line source |
---|---|
0 | 1 /* |
17467
55fb97c4c58d
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12021
diff
changeset
|
2 * Copyright (c) 2005, 2013, 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 |
12021 | 142 String postBuildCmd = BuildConfig.getFieldString(null, |
143 "PostbuildCommand"); | |
144 if (postBuildCmd != null) { | |
145 tag("Tool", | |
146 new String[] { | |
147 "Name", | |
148 "VCPostBuildEventTool", | |
149 "Description", | |
150 BuildConfig | |
151 .getFieldString(null, "PostbuildDescription"), | |
152 // Caution: String.replace(String,String) is available | |
153 // from JDK5 onwards only | |
154 "CommandLine", | |
155 cfg.expandFormat(postBuildCmd.replace("\t", | |
156 "
")) }); | |
157 } | |
0 | 158 |
6801 | 159 tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); |
0 | 160 |
6801 | 161 tag("Tool", |
162 new String[] { | |
163 "Name", | |
164 "VCPreLinkEventTool", | |
165 "Description", | |
166 BuildConfig.getFieldString(null, "PrelinkDescription"), | |
167 // Caution: String.replace(String,String) is available | |
168 // from JDK5 onwards only | |
169 "CommandLine", | |
170 cfg.expandFormat(BuildConfig.getFieldString(null, | |
171 "PrelinkCommand").replace("\t", "
")) }); | |
0 | 172 |
6801 | 173 tag("Tool", new String[] { "Name", "VCResourceCompilerTool", |
174 "PreprocessorDefinitions", "NDEBUG", "Culture", "1033" }); | |
0 | 175 |
6801 | 176 tag("Tool", new String[] { "Name", "VCMIDLTool", |
177 "PreprocessorDefinitions", "NDEBUG", "MkTypLibCompatible", | |
178 "TRUE", "SuppressStartupBanner", "TRUE", "TargetEnvironment", | |
179 "1", "TypeLibraryName", | |
180 cfg.get("OutputDir") + Util.sep + "vm.tlb", "HeaderFileName", | |
181 "" }); | |
0 | 182 |
6801 | 183 endTag(); |
184 } | |
0 | 185 |
186 | |
187 | |
6801 | 188 protected String getProjectExt() { |
189 return ".vcproj"; | |
190 } | |
0 | 191 } |
192 | |
193 class CompilerInterfaceVC7 extends CompilerInterface { | |
6801 | 194 void getBaseCompilerFlags_common(Vector defines, Vector includes, |
195 String outDir, Vector rv) { | |
0 | 196 |
6801 | 197 // advanced M$ IDE (2003) can only recognize name if it's first or |
198 // second attribute in the tag - go guess | |
199 addAttr(rv, "Name", "VCCLCompilerTool"); | |
200 addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes)); | |
201 addAttr(rv, "PreprocessorDefinitions", | |
202 Util.join(";", defines).replace("\"", """)); | |
203 addAttr(rv, "PrecompiledHeaderThrough", "precompiled.hpp"); | |
204 addAttr(rv, "PrecompiledHeaderFile", outDir + Util.sep + "vm.pch"); | |
205 addAttr(rv, "AssemblerListingLocation", outDir); | |
206 addAttr(rv, "ObjectFile", outDir + Util.sep); | |
207 addAttr(rv, "ProgramDataBaseFileName", outDir + Util.sep + "jvm.pdb"); | |
208 // Set /nologo optin | |
209 addAttr(rv, "SuppressStartupBanner", "TRUE"); | |
210 // Surpass the default /Tc or /Tp. 0 is compileAsDefault | |
211 addAttr(rv, "CompileAs", "0"); | |
212 // Set /W3 option. 3 is warningLevel_3 | |
213 addAttr(rv, "WarningLevel", "3"); | |
214 // Set /WX option, | |
215 addAttr(rv, "WarnAsError", "TRUE"); | |
216 // Set /GS option | |
217 addAttr(rv, "BufferSecurityCheck", "FALSE"); | |
218 // Set /Zi option. 3 is debugEnabled | |
219 addAttr(rv, "DebugInformationFormat", "3"); | |
220 } | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
221 |
6801 | 222 Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir) { |
223 Vector rv = new Vector(); | |
0 | 224 |
6801 | 225 getBaseCompilerFlags_common(defines, includes, outDir, rv); |
226 // Set /Yu option. 3 is pchUseUsingSpecific | |
227 // Note: Starting VC8 pchUseUsingSpecific is 2 !!! | |
228 addAttr(rv, "UsePrecompiledHeader", "3"); | |
229 // Set /EHsc- option | |
230 addAttr(rv, "ExceptionHandling", "FALSE"); | |
0 | 231 |
6801 | 232 return rv; |
233 } | |
234 | |
235 Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) { | |
236 Vector rv = new Vector(); | |
0 | 237 |
6801 | 238 addAttr(rv, "Name", "VCLinkerTool"); |
239 addAttr(rv, "AdditionalOptions", | |
240 "/export:JNI_GetDefaultJavaVMInitArgs " | |
241 + "/export:JNI_CreateJavaVM " | |
242 + "/export:JVM_FindClassFromBootLoader " | |
243 + "/export:JNI_GetCreatedJavaVMs " | |
244 + "/export:jio_snprintf /export:jio_printf " | |
245 + "/export:jio_fprintf /export:jio_vfprintf " | |
246 + "/export:jio_vsnprintf " | |
247 + "/export:JVM_GetVersionInfo " | |
248 + "/export:JVM_GetThreadStateNames " | |
249 + "/export:JVM_GetThreadStateValues " | |
250 + "/export:JVM_InitAgentProperties "); | |
251 addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib"); | |
252 addAttr(rv, "OutputFile", outDll); | |
253 // Set /INCREMENTAL option. 1 is linkIncrementalNo | |
254 addAttr(rv, "LinkIncremental", "1"); | |
255 addAttr(rv, "SuppressStartupBanner", "TRUE"); | |
256 addAttr(rv, "ModuleDefinitionFile", outDir + Util.sep + "vm.def"); | |
257 addAttr(rv, "ProgramDatabaseFile", outDir + Util.sep + "jvm.pdb"); | |
258 // Set /SUBSYSTEM option. 2 is subSystemWindows | |
259 addAttr(rv, "SubSystem", "2"); | |
260 addAttr(rv, "BaseAddress", "0x8000000"); | |
261 addAttr(rv, "ImportLibrary", outDir + Util.sep + "jvm.lib"); | |
262 if (platformName.equals("Win32")) { | |
263 // Set /MACHINE option. 1 is X86 | |
264 addAttr(rv, "TargetMachine", "1"); | |
265 } else { | |
266 // Set /MACHINE option. 17 is X64 | |
267 addAttr(rv, "TargetMachine", "17"); | |
268 } | |
0 | 269 |
6801 | 270 return rv; |
271 } | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
272 |
6801 | 273 void getDebugCompilerFlags_common(String opt, Vector rv) { |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
274 |
6801 | 275 // Set /On option |
276 addAttr(rv, "Optimization", opt); | |
277 // Set /FR option. 1 is brAllInfo | |
278 addAttr(rv, "BrowseInformation", "1"); | |
279 addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep); | |
280 // Set /MD option. 2 is rtMultiThreadedDLL | |
281 addAttr(rv, "RuntimeLibrary", "2"); | |
282 // Set /Oy- option | |
283 addAttr(rv, "OmitFramePointers", "FALSE"); | |
659
520d43965b1f
6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents:
0
diff
changeset
|
284 |
6801 | 285 } |
286 | |
287 Vector getDebugCompilerFlags(String opt) { | |
288 Vector rv = new Vector(); | |
0 | 289 |
6801 | 290 getDebugCompilerFlags_common(opt, rv); |
0 | 291 |
6801 | 292 return rv; |
293 } | |
0 | 294 |
6801 | 295 Vector getDebugLinkerFlags() { |
296 Vector rv = new Vector(); | |
0 | 297 |
6801 | 298 addAttr(rv, "GenerateDebugInformation", "TRUE"); // == /DEBUG option |
0 | 299 |
6801 | 300 return rv; |
301 } | |
302 | |
303 void getAdditionalNonKernelLinkerFlags(Vector rv) { | |
304 extAttr(rv, "AdditionalOptions", "/export:AsyncGetCallTrace "); | |
305 } | |
2027
aa6e219afbf1
7006354: Updates to Visual Studio project creation and development launcher
sla
parents:
1972
diff
changeset
|
306 |
6801 | 307 void getProductCompilerFlags_common(Vector rv) { |
308 // Set /O2 option. 2 is optimizeMaxSpeed | |
309 addAttr(rv, "Optimization", "2"); | |
310 // Set /Oy- option | |
311 addAttr(rv, "OmitFramePointers", "FALSE"); | |
312 // Set /Ob option. 1 is expandOnlyInline | |
313 addAttr(rv, "InlineFunctionExpansion", "1"); | |
314 // Set /GF option. | |
315 addAttr(rv, "StringPooling", "TRUE"); | |
316 // Set /MD option. 2 is rtMultiThreadedDLL | |
317 addAttr(rv, "RuntimeLibrary", "2"); | |
318 // Set /Gy option | |
319 addAttr(rv, "EnableFunctionLevelLinking", "TRUE"); | |
320 } | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
321 |
6801 | 322 Vector getProductCompilerFlags() { |
323 Vector rv = new Vector(); | |
2233
15d6977f04b0
7017824: Add support for creating 64-bit Visual Studio projects
sla
parents:
2027
diff
changeset
|
324 |
6801 | 325 getProductCompilerFlags_common(rv); |
0 | 326 |
6801 | 327 return rv; |
328 } | |
0 | 329 |
6801 | 330 Vector getProductLinkerFlags() { |
331 Vector rv = new Vector(); | |
0 | 332 |
6801 | 333 // Set /OPT:REF option. 2 is optReferences |
334 addAttr(rv, "OptimizeReferences", "2"); | |
335 // Set /OPT:optFolding option. 2 is optFolding | |
336 addAttr(rv, "EnableCOMDATFolding", "2"); | |
0 | 337 |
6801 | 338 return rv; |
339 } | |
0 | 340 |
6801 | 341 String getOptFlag() { |
342 return "2"; | |
343 } | |
0 | 344 |
6801 | 345 String getNoOptFlag() { |
346 return "0"; | |
347 } | |
0 | 348 |
6801 | 349 String makeCfgName(String flavourBuild, String platform) { |
350 return flavourBuild + "|" + platform; | |
351 } | |
352 | |
0 | 353 } |