annotate src/share/tools/MakeDeps/Platform.java @ 1716:be3f9c242c9d

6948538: CMS: BOT walkers can fall into object allocation and initialization cracks Summary: GC workers now recognize an intermediate transient state of blocks which are allocated but have not yet completed initialization. blk_start() calls do not attempt to determine the size of a block in the transient state, rather waiting for the block to become initialized so that it is safe to query its size. Audited and ensured the order of initialization of object fields (klass, free bit and size) to respect block state transition protocol. Also included some new assertion checking code enabled in debug mode. Reviewed-by: chrisphi, johnc, poonam
author ysr
date Mon, 16 Aug 2010 15:58:42 -0700
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 /** Defines what must be specified for each platform. This class must
a61af66fc99e Initial load
duke
parents:
diff changeset
26 have a no-arg constructor. */
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 public abstract class Platform {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 /** file name templates capture naming conventions */
a61af66fc99e Initial load
duke
parents:
diff changeset
32 protected FileName dummyFileTemplate =
a61af66fc99e Initial load
duke
parents:
diff changeset
33 new FileName(this, "", "", "", "", "", "");
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // The next three must be instantiated in subclasses' constructors
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 /** An incl file is produced per .c file and contains all the
a61af66fc99e Initial load
duke
parents:
diff changeset
38 includes it needs */
a61af66fc99e Initial load
duke
parents:
diff changeset
39 protected FileName inclFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 /** A GI (grand-include) file has any file used more than N times
a61af66fc99e Initial load
duke
parents:
diff changeset
42 for precompiled headers */
a61af66fc99e Initial load
duke
parents:
diff changeset
43 protected FileName giFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 /** A GD (grand-dependencies) file that tells Unix make all the
a61af66fc99e Initial load
duke
parents:
diff changeset
46 .o's needed for linking and the include dependencies */
a61af66fc99e Initial load
duke
parents:
diff changeset
47 protected FileName gdFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public FileName getInclFileTemplate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 return inclFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public FileName getGIFileTemplate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 return giFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 public FileName getGDFileTemplate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 return gdFileTemplate;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // an incl file is the file included by each.c file that includes
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // all needed header files
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 public abstract void setupFileTemplates();
a61af66fc99e Initial load
duke
parents:
diff changeset
66 public abstract String[] outerSuffixes();
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 /** empty file name -> no grand include file */
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public boolean haveGrandInclude() {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 return (giFileTemplate.nameOfList().length() > 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public boolean writeDeps() {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 return (gdFileTemplate.nameOfList().length() > 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 /** <p> A gi file is the grand-include file. It includes in one
a61af66fc99e Initial load
duke
parents:
diff changeset
78 file any file that is included more than a certain number of
a61af66fc99e Initial load
duke
parents:
diff changeset
79 times. </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 <p> It is used for precompiled header files. </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 <p> It has a source name, that is the file that this program
a61af66fc99e Initial load
duke
parents:
diff changeset
84 generates, and a compiled name; that is the file that is
a61af66fc99e Initial load
duke
parents:
diff changeset
85 included by other files. </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 <p> Some platforms have this program actually explictly
a61af66fc99e Initial load
duke
parents:
diff changeset
88 include the preprocessed gi file-- see includeGIInEachIncl().
a61af66fc99e Initial load
duke
parents:
diff changeset
89 </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 <p> Also, some platforms need a pragma in the GI file. </p> */
a61af66fc99e Initial load
duke
parents:
diff changeset
92 public boolean includeGIInEachIncl() {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 /** For some platforms, e.g. Solaris, include the grand-include
a61af66fc99e Initial load
duke
parents:
diff changeset
97 dependencies in the makefile. For others, e.g. Windows, do
a61af66fc99e Initial load
duke
parents:
diff changeset
98 not. */
a61af66fc99e Initial load
duke
parents:
diff changeset
99 public boolean includeGIDependencies() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 /** Should C/C++ source file be dependent on a file included
a61af66fc99e Initial load
duke
parents:
diff changeset
104 into the grand-include file. */
a61af66fc99e Initial load
duke
parents:
diff changeset
105 public boolean writeDependenciesOnHFilesFromGI() {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 /** Default implementation does nothing */
a61af66fc99e Initial load
duke
parents:
diff changeset
110 public void writeGIPragma(PrintWriter out) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 /** A line with a filename and the noGrandInclude string means
a61af66fc99e Initial load
duke
parents:
diff changeset
114 that this file cannot use the precompiled header. */
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public String noGrandInclude() {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 return "no_precompiled_headers";
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 /** A line with a filename and the
a61af66fc99e Initial load
duke
parents:
diff changeset
120 generatePlatformDependentInclude means that an include file
a61af66fc99e Initial load
duke
parents:
diff changeset
121 for the header file must be generated. This file generated include
a61af66fc99e Initial load
duke
parents:
diff changeset
122 file is directly included by the non-platform dependent include file
a61af66fc99e Initial load
duke
parents:
diff changeset
123 (e.g os.hpp includes _os_pd.hpp.incl. So while we notice files that
a61af66fc99e Initial load
duke
parents:
diff changeset
124 are directly dependent on non-platform dependent files from the database
a61af66fc99e Initial load
duke
parents:
diff changeset
125 we must infer the dependence on platform specific files to generate correct
a61af66fc99e Initial load
duke
parents:
diff changeset
126 dependences on the platform specific files. */
a61af66fc99e Initial load
duke
parents:
diff changeset
127 public String generatePlatformDependentInclude() {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return "generate_platform_dependent_include";
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 /** Prefix and suffix strings for emitting Makefile rules */
a61af66fc99e Initial load
duke
parents:
diff changeset
132 public abstract String objFileSuffix();
a61af66fc99e Initial load
duke
parents:
diff changeset
133 public abstract String asmFileSuffix();
a61af66fc99e Initial load
duke
parents:
diff changeset
134 public abstract String dependentPrefix();
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // Exit routines:
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 /** Abort means an internal error */
a61af66fc99e Initial load
duke
parents:
diff changeset
139 public void abort() {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 throw new RuntimeException("Internal error");
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 /** fatalError is used by clients to stop the system */
a61af66fc99e Initial load
duke
parents:
diff changeset
144 public void fatalError(String msg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 System.err.println(msg);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 System.exit(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 /** Default implementation performs case-sensitive comparison */
a61af66fc99e Initial load
duke
parents:
diff changeset
150 public boolean fileNameStringEquality(String s1, String s2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 return s1.equals(s2);
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 public void fileNamePortabilityCheck(String name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if (Character.isUpperCase(name.charAt(0))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 fatalError("Error: for the sake of portability we have chosen\n" +
a61af66fc99e Initial load
duke
parents:
diff changeset
157 "to avoid files starting with an uppercase letter.\n" +
a61af66fc99e Initial load
duke
parents:
diff changeset
158 "Please rename " + name + ".");
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 public void fileNamePortabilityCheck(String name, String matchingName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 if (!name.equals(matchingName)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 fatalError("Error: file " + name + " also appears as " +
a61af66fc99e Initial load
duke
parents:
diff changeset
165 matchingName + ". Case must be consistent for " +
a61af66fc99e Initial load
duke
parents:
diff changeset
166 "portability.");
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 }
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 /** max is 31 on mac, so warn */
a61af66fc99e Initial load
duke
parents:
diff changeset
171 public int fileNameLengthLimit() {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 return 45;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 public int defaultGrandIncludeThreshold() {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 return 30;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 /** Not very general, but this is a way to get platform-specific
a61af66fc99e Initial load
duke
parents:
diff changeset
180 files to be written. Default implementation does nothing. */
a61af66fc99e Initial load
duke
parents:
diff changeset
181 public void writePlatformSpecificFiles(Database previousDB,
a61af66fc99e Initial load
duke
parents:
diff changeset
182 Database currentDB, String[] args)
a61af66fc99e Initial load
duke
parents:
diff changeset
183 throws IllegalArgumentException, IOException {
a61af66fc99e Initial load
duke
parents:
diff changeset
184 }
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }