annotate src/share/tools/MakeDeps/FileName.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, 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 public class FileName {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 private String dir;
a61af66fc99e Initial load
duke
parents:
diff changeset
27 private String prefix;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 private String stem;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 private String suffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 private String inverseDir;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 private String altSuffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 private String dpss;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 private String psa;
a61af66fc99e Initial load
duke
parents:
diff changeset
35 private String dpsa;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 private String pss;
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 private Platform plat;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 /** None of the passed strings may be null. */
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 public FileName(Platform plat, String dir, String prefix,
a61af66fc99e Initial load
duke
parents:
diff changeset
43 String stem, String suffix,
a61af66fc99e Initial load
duke
parents:
diff changeset
44 String inverseDir, String altSuffix) {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 if ((dir == null) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
46 (prefix == null) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
47 (stem == null) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
48 (suffix == null) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
49 (inverseDir == null) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
50 (altSuffix == null)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 throw new NullPointerException("All arguments must be non-null");
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 this.plat = plat;
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 this.dir = dir;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 this.prefix = prefix;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 this.stem = stem;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 this.suffix = suffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 this.inverseDir = inverseDir;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 this.altSuffix = altSuffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 pss = prefix + stem + suffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 dpss = dir + prefix + stem + suffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 psa = prefix + stem + altSuffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 dpsa = dir + prefix + stem + altSuffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 checkLength(plat);
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 public void checkLength(Platform p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 int len;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 String s;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 int suffLen = suffix.length();
a61af66fc99e Initial load
duke
parents:
diff changeset
75 int altSuffLen = altSuffix.length();
a61af66fc99e Initial load
duke
parents:
diff changeset
76 if (suffLen >= altSuffLen) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 len = suffLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 s = suffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 len = altSuffLen;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 s = altSuffix;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 len += prefix.length() + stem.length();
a61af66fc99e Initial load
duke
parents:
diff changeset
84 int lim = p.fileNameLengthLimit();
a61af66fc99e Initial load
duke
parents:
diff changeset
85 if (len > lim) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 p.fatalError(prefix + stem + s + " is too long: " +
a61af66fc99e Initial load
duke
parents:
diff changeset
87 len + " >= " + lim);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 public String dirPreStemSuff() {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 return dpss;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 public String preStemSuff() {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 return pss;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 public String dirPreStemAltSuff() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 return dpsa;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 public String preStemAltSuff() {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 return psa;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 public FileName copyStem(String newStem) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return new FileName(plat, dir, prefix, newStem,
a61af66fc99e Initial load
duke
parents:
diff changeset
109 suffix, inverseDir, altSuffix);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 String nameOfList() {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 return stem;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 String getInvDir() {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 return inverseDir;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }