annotate src/share/vm/runtime/fieldType.cpp @ 94:0834225a7916

6634032: CMS: Need CMSInitiatingPermOccupancyFraction for perm, divorcing from CMSInitiatingOccupancyFraction Summary: The option CMSInitiatingPermOccupancyFraction now controls perm triggering threshold. Even though the actual value of the threshold has not yet been changed, so there is no change in policy, we now have the infrastructure in place for dynamically deciding when to collect the perm gen, an issue that will be addressed in the near future. Reviewed-by: jmasa
author ysr
date Sun, 16 Mar 2008 21:57:25 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_fieldType.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 void FieldType::skip_optional_size(symbolOop signature, int* index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
29 jchar c = signature->byte_at(*index);
a61af66fc99e Initial load
duke
parents:
diff changeset
30 while (c >= '0' && c <= '9') {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 *index = *index + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 c = signature->byte_at(*index);
a61af66fc99e Initial load
duke
parents:
diff changeset
33 }
a61af66fc99e Initial load
duke
parents:
diff changeset
34 }
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 BasicType FieldType::basic_type(symbolOop signature) {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 return char2type(signature->byte_at(0));
a61af66fc99e Initial load
duke
parents:
diff changeset
38 }
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // Check if it is a valid array signature
a61af66fc99e Initial load
duke
parents:
diff changeset
41 bool FieldType::is_valid_array_signature(symbolOop sig) {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 assert(sig->utf8_length() > 1, "this should already have been checked");
a61af66fc99e Initial load
duke
parents:
diff changeset
43 assert(sig->byte_at(0) == '[', "this should already have been checked");
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // The first character is already checked
a61af66fc99e Initial load
duke
parents:
diff changeset
45 int i = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 int len = sig->utf8_length();
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // First skip all '['s
a61af66fc99e Initial load
duke
parents:
diff changeset
48 while(i < len - 1 && sig->byte_at(i) == '[') i++;
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // Check type
a61af66fc99e Initial load
duke
parents:
diff changeset
51 switch(sig->byte_at(i)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 case 'B': // T_BYTE
a61af66fc99e Initial load
duke
parents:
diff changeset
53 case 'C': // T_CHAR
a61af66fc99e Initial load
duke
parents:
diff changeset
54 case 'D': // T_DOUBLE
a61af66fc99e Initial load
duke
parents:
diff changeset
55 case 'F': // T_FLOAT
a61af66fc99e Initial load
duke
parents:
diff changeset
56 case 'I': // T_INT
a61af66fc99e Initial load
duke
parents:
diff changeset
57 case 'J': // T_LONG
a61af66fc99e Initial load
duke
parents:
diff changeset
58 case 'S': // T_SHORT
a61af66fc99e Initial load
duke
parents:
diff changeset
59 case 'Z': // T_BOOLEAN
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // If it is an array, the type is the last character
a61af66fc99e Initial load
duke
parents:
diff changeset
61 return (i + 1 == len);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 case 'L':
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // If it is an object, the last character must be a ';'
a61af66fc99e Initial load
duke
parents:
diff changeset
64 return sig->byte_at(len - 1) == ';';
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71 BasicType FieldType::get_array_info(symbolOop signature, jint* dimension, symbolOop* object_key, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 assert(basic_type(signature) == T_ARRAY, "must be array");
a61af66fc99e Initial load
duke
parents:
diff changeset
73 int index = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 int dim = 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 skip_optional_size(signature, &index);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 while (signature->byte_at(index) == '[') {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 index++;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 dim++;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 skip_optional_size(signature, &index);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 ResourceMark rm;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 symbolOop element = oopFactory::new_symbol(signature->as_C_string() + index, CHECK_(T_BYTE));
a61af66fc99e Initial load
duke
parents:
diff changeset
83 BasicType element_type = FieldType::basic_type(element);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if (element_type == T_OBJECT) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 char* object_type = element->as_C_string();
a61af66fc99e Initial load
duke
parents:
diff changeset
86 object_type[element->utf8_length() - 1] = '\0';
a61af66fc99e Initial load
duke
parents:
diff changeset
87 *object_key = oopFactory::new_symbol(object_type + 1, CHECK_(T_BYTE));
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Pass dimension back to caller
a61af66fc99e Initial load
duke
parents:
diff changeset
90 *dimension = dim;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 return element_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }