Mercurial > hg > truffle
annotate src/share/tools/MakeDeps/Platform.java @ 1656:4e5661ba9d98
6944166: G1: explicit GCs are not always handled correctly
Summary: G1 was not handling explicit GCs correctly in many ways. It does now. See the CR for the list of improvements contained in this changeset.
Reviewed-by: iveresov, ysr, johnc
author | tonyp |
---|---|
date | Mon, 28 Jun 2010 14:13:17 -0400 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 1999, 2005, 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:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 /** Defines what must be specified for each platform. This class must | |
26 have a no-arg constructor. */ | |
27 | |
28 import java.io.*; | |
29 | |
30 public abstract class Platform { | |
31 /** file name templates capture naming conventions */ | |
32 protected FileName dummyFileTemplate = | |
33 new FileName(this, "", "", "", "", "", ""); | |
34 | |
35 // The next three must be instantiated in subclasses' constructors | |
36 | |
37 /** An incl file is produced per .c file and contains all the | |
38 includes it needs */ | |
39 protected FileName inclFileTemplate; | |
40 | |
41 /** A GI (grand-include) file has any file used more than N times | |
42 for precompiled headers */ | |
43 protected FileName giFileTemplate; | |
44 | |
45 /** A GD (grand-dependencies) file that tells Unix make all the | |
46 .o's needed for linking and the include dependencies */ | |
47 protected FileName gdFileTemplate; | |
48 | |
49 // Accessors | |
50 public FileName getInclFileTemplate() { | |
51 return inclFileTemplate; | |
52 } | |
53 | |
54 public FileName getGIFileTemplate() { | |
55 return giFileTemplate; | |
56 } | |
57 | |
58 public FileName getGDFileTemplate() { | |
59 return gdFileTemplate; | |
60 } | |
61 | |
62 // an incl file is the file included by each.c file that includes | |
63 // all needed header files | |
64 | |
65 public abstract void setupFileTemplates(); | |
66 public abstract String[] outerSuffixes(); | |
67 | |
68 /** empty file name -> no grand include file */ | |
69 public boolean haveGrandInclude() { | |
70 return (giFileTemplate.nameOfList().length() > 0); | |
71 } | |
72 | |
73 public boolean writeDeps() { | |
74 return (gdFileTemplate.nameOfList().length() > 0); | |
75 } | |
76 | |
77 /** <p> A gi file is the grand-include file. It includes in one | |
78 file any file that is included more than a certain number of | |
79 times. </p> | |
80 | |
81 <p> It is used for precompiled header files. </p> | |
82 | |
83 <p> It has a source name, that is the file that this program | |
84 generates, and a compiled name; that is the file that is | |
85 included by other files. </p> | |
86 | |
87 <p> Some platforms have this program actually explictly | |
88 include the preprocessed gi file-- see includeGIInEachIncl(). | |
89 </p> | |
90 | |
91 <p> Also, some platforms need a pragma in the GI file. </p> */ | |
92 public boolean includeGIInEachIncl() { | |
93 return false; | |
94 } | |
95 | |
96 /** For some platforms, e.g. Solaris, include the grand-include | |
97 dependencies in the makefile. For others, e.g. Windows, do | |
98 not. */ | |
99 public boolean includeGIDependencies() { | |
100 return false; | |
101 } | |
102 | |
103 /** Should C/C++ source file be dependent on a file included | |
104 into the grand-include file. */ | |
105 public boolean writeDependenciesOnHFilesFromGI() { | |
106 return false; | |
107 } | |
108 | |
109 /** Default implementation does nothing */ | |
110 public void writeGIPragma(PrintWriter out) { | |
111 } | |
112 | |
113 /** A line with a filename and the noGrandInclude string means | |
114 that this file cannot use the precompiled header. */ | |
115 public String noGrandInclude() { | |
116 return "no_precompiled_headers"; | |
117 } | |
118 | |
119 /** A line with a filename and the | |
120 generatePlatformDependentInclude means that an include file | |
121 for the header file must be generated. This file generated include | |
122 file is directly included by the non-platform dependent include file | |
123 (e.g os.hpp includes _os_pd.hpp.incl. So while we notice files that | |
124 are directly dependent on non-platform dependent files from the database | |
125 we must infer the dependence on platform specific files to generate correct | |
126 dependences on the platform specific files. */ | |
127 public String generatePlatformDependentInclude() { | |
128 return "generate_platform_dependent_include"; | |
129 } | |
130 | |
131 /** Prefix and suffix strings for emitting Makefile rules */ | |
132 public abstract String objFileSuffix(); | |
133 public abstract String asmFileSuffix(); | |
134 public abstract String dependentPrefix(); | |
135 | |
136 // Exit routines: | |
137 | |
138 /** Abort means an internal error */ | |
139 public void abort() { | |
140 throw new RuntimeException("Internal error"); | |
141 } | |
142 | |
143 /** fatalError is used by clients to stop the system */ | |
144 public void fatalError(String msg) { | |
145 System.err.println(msg); | |
146 System.exit(1); | |
147 } | |
148 | |
149 /** Default implementation performs case-sensitive comparison */ | |
150 public boolean fileNameStringEquality(String s1, String s2) { | |
151 return s1.equals(s2); | |
152 } | |
153 | |
154 public void fileNamePortabilityCheck(String name) { | |
155 if (Character.isUpperCase(name.charAt(0))) { | |
156 fatalError("Error: for the sake of portability we have chosen\n" + | |
157 "to avoid files starting with an uppercase letter.\n" + | |
158 "Please rename " + name + "."); | |
159 } | |
160 } | |
161 | |
162 public void fileNamePortabilityCheck(String name, String matchingName) { | |
163 if (!name.equals(matchingName)) { | |
164 fatalError("Error: file " + name + " also appears as " + | |
165 matchingName + ". Case must be consistent for " + | |
166 "portability."); | |
167 } | |
168 } | |
169 | |
170 /** max is 31 on mac, so warn */ | |
171 public int fileNameLengthLimit() { | |
172 return 45; | |
173 } | |
174 | |
175 public int defaultGrandIncludeThreshold() { | |
176 return 30; | |
177 } | |
178 | |
179 /** Not very general, but this is a way to get platform-specific | |
180 files to be written. Default implementation does nothing. */ | |
181 public void writePlatformSpecificFiles(Database previousDB, | |
182 Database currentDB, String[] args) | |
183 throws IllegalArgumentException, IOException { | |
184 } | |
185 } |