src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Thu, 24 Mar 2016 21:38:15 -0700

author
iklam
date
Thu, 24 Mar 2016 21:38:15 -0700
changeset 8497
50e62b688ddc
parent 7327
50054b63f0aa
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

8150752: Share Class Data
Reviewed-by: acorn, hseigel, mschoene

duke@435 1 /*
mikael@6198 2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "classfile/symbolTable.hpp"
stefank@2314 27 #include "interpreter/bytecodeStream.hpp"
never@3137 28 #include "oops/fieldStreams.hpp"
stefank@2314 29 #include "prims/jvmtiClassFileReconstituter.hpp"
stefank@2314 30 #include "runtime/signature.hpp"
stefank@2314 31 #ifdef TARGET_ARCH_x86
stefank@2314 32 # include "bytes_x86.hpp"
stefank@2314 33 #endif
stefank@2314 34 #ifdef TARGET_ARCH_sparc
stefank@2314 35 # include "bytes_sparc.hpp"
stefank@2314 36 #endif
stefank@2314 37 #ifdef TARGET_ARCH_zero
stefank@2314 38 # include "bytes_zero.hpp"
stefank@2314 39 #endif
bobv@2508 40 #ifdef TARGET_ARCH_arm
bobv@2508 41 # include "bytes_arm.hpp"
bobv@2508 42 #endif
bobv@2508 43 #ifdef TARGET_ARCH_ppc
bobv@2508 44 # include "bytes_ppc.hpp"
bobv@2508 45 #endif
minqi@4083 46 // FIXME: add Deprecated attribute
duke@435 47 // FIXME: fix Synthetic attribute
coleenp@4037 48 // FIXME: per Serguei, add error return handling for ConstantPool::copy_cpool_bytes()
duke@435 49
duke@435 50
duke@435 51 // Write the field information portion of ClassFile structure
duke@435 52 // JVMSpec| u2 fields_count;
duke@435 53 // JVMSpec| field_info fields[fields_count];
duke@435 54 void JvmtiClassFileReconstituter::write_field_infos() {
duke@435 55 HandleMark hm(thread());
coleenp@4037 56 Array<AnnotationArray*>* fields_anno = ikh()->fields_annotations();
aeriksso@7327 57 Array<AnnotationArray*>* fields_type_anno = ikh()->fields_type_annotations();
duke@435 58
never@3137 59 // Compute the real number of Java fields
never@3137 60 int java_fields = ikh()->java_fields_count();
never@3137 61
never@3143 62 write_u2(java_fields);
never@3137 63 for (JavaFieldStream fs(ikh()); !fs.done(); fs.next()) {
never@3137 64 AccessFlags access_flags = fs.access_flags();
never@3137 65 int name_index = fs.name_index();
never@3137 66 int signature_index = fs.signature_index();
never@3137 67 int initial_value_index = fs.initval_index();
duke@435 68 guarantee(name_index != 0 && signature_index != 0, "bad constant pool index for field");
never@3137 69 // int offset = ikh()->field_offset( index );
never@3137 70 int generic_signature_index = fs.generic_signature_index();
coleenp@4037 71 AnnotationArray* anno = fields_anno == NULL ? NULL : fields_anno->at(fs.index());
aeriksso@7327 72 AnnotationArray* type_anno = fields_type_anno == NULL ? NULL : fields_type_anno->at(fs.index());
duke@435 73
duke@435 74 // JVMSpec| field_info {
duke@435 75 // JVMSpec| u2 access_flags;
duke@435 76 // JVMSpec| u2 name_index;
duke@435 77 // JVMSpec| u2 descriptor_index;
duke@435 78 // JVMSpec| u2 attributes_count;
duke@435 79 // JVMSpec| attribute_info attributes[attributes_count];
duke@435 80 // JVMSpec| }
duke@435 81
never@3137 82 write_u2(access_flags.as_int() & JVM_RECOGNIZED_FIELD_MODIFIERS);
duke@435 83 write_u2(name_index);
duke@435 84 write_u2(signature_index);
duke@435 85 int attr_count = 0;
duke@435 86 if (initial_value_index != 0) {
duke@435 87 ++attr_count;
duke@435 88 }
duke@435 89 if (access_flags.is_synthetic()) {
duke@435 90 // ++attr_count;
duke@435 91 }
duke@435 92 if (generic_signature_index != 0) {
duke@435 93 ++attr_count;
duke@435 94 }
coleenp@4037 95 if (anno != NULL) {
duke@435 96 ++attr_count; // has RuntimeVisibleAnnotations attribute
duke@435 97 }
aeriksso@7327 98 if (type_anno != NULL) {
aeriksso@7327 99 ++attr_count; // has RuntimeVisibleTypeAnnotations attribute
aeriksso@7327 100 }
duke@435 101
duke@435 102 write_u2(attr_count);
duke@435 103
duke@435 104 if (initial_value_index != 0) {
duke@435 105 write_attribute_name_index("ConstantValue");
duke@435 106 write_u4(2); //length always 2
duke@435 107 write_u2(initial_value_index);
duke@435 108 }
duke@435 109 if (access_flags.is_synthetic()) {
duke@435 110 // write_synthetic_attribute();
duke@435 111 }
duke@435 112 if (generic_signature_index != 0) {
duke@435 113 write_signature_attribute(generic_signature_index);
duke@435 114 }
coleenp@4037 115 if (anno != NULL) {
duke@435 116 write_annotations_attribute("RuntimeVisibleAnnotations", anno);
duke@435 117 }
aeriksso@7327 118 if (type_anno != NULL) {
aeriksso@7327 119 write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
aeriksso@7327 120 }
duke@435 121 }
duke@435 122 }
duke@435 123
duke@435 124 // Write Code attribute
duke@435 125 // JVMSpec| Code_attribute {
duke@435 126 // JVMSpec| u2 attribute_name_index;
duke@435 127 // JVMSpec| u4 attribute_length;
duke@435 128 // JVMSpec| u2 max_stack;
duke@435 129 // JVMSpec| u2 max_locals;
duke@435 130 // JVMSpec| u4 code_length;
duke@435 131 // JVMSpec| u1 code[code_length];
duke@435 132 // JVMSpec| u2 exception_table_length;
duke@435 133 // JVMSpec| { u2 start_pc;
duke@435 134 // JVMSpec| u2 end_pc;
duke@435 135 // JVMSpec| u2 handler_pc;
duke@435 136 // JVMSpec| u2 catch_type;
duke@435 137 // JVMSpec| } exception_table[exception_table_length];
duke@435 138 // JVMSpec| u2 attributes_count;
duke@435 139 // JVMSpec| attribute_info attributes[attributes_count];
duke@435 140 // JVMSpec| }
duke@435 141 void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
coleenp@4037 142 ConstMethod* const_method = method->constMethod();
duke@435 143 u2 line_num_cnt = 0;
duke@435 144 int stackmap_len = 0;
coleenp@3345 145 int local_variable_table_length = 0;
minqi@4083 146 int local_variable_type_table_length = 0;
duke@435 147
coleenp@3345 148 // compute number and length of attributes
duke@435 149 int attr_count = 0;
duke@435 150 int attr_size = 0;
duke@435 151 if (const_method->has_linenumber_table()) {
duke@435 152 line_num_cnt = line_number_table_entries(method);
duke@435 153 if (line_num_cnt != 0) {
duke@435 154 ++attr_count;
duke@435 155 // Compute the complete size of the line number table attribute:
duke@435 156 // LineNumberTable_attribute {
duke@435 157 // u2 attribute_name_index;
duke@435 158 // u4 attribute_length;
duke@435 159 // u2 line_number_table_length;
duke@435 160 // { u2 start_pc;
duke@435 161 // u2 line_number;
duke@435 162 // } line_number_table[line_number_table_length];
duke@435 163 // }
duke@435 164 attr_size += 2 + 4 + 2 + line_num_cnt * (2 + 2);
duke@435 165 }
duke@435 166 }
duke@435 167 if (method->has_stackmap_table()) {
duke@435 168 stackmap_len = method->stackmap_data()->length();
duke@435 169 if (stackmap_len != 0) {
duke@435 170 ++attr_count;
duke@435 171 // Compute the size of the stack map table attribute (VM stores raw):
duke@435 172 // StackMapTable_attribute {
duke@435 173 // u2 attribute_name_index;
duke@435 174 // u4 attribute_length;
duke@435 175 // u2 number_of_entries;
duke@435 176 // stack_map_frame_entries[number_of_entries];
duke@435 177 // }
duke@435 178 attr_size += 2 + 4 + stackmap_len;
duke@435 179 }
duke@435 180 }
coleenp@3345 181 if (method->has_localvariable_table()) {
coleenp@3345 182 local_variable_table_length = method->localvariable_table_length();
coleenp@3345 183 if (local_variable_table_length != 0) {
minqi@4083 184 ++attr_count;
coleenp@3345 185 // Compute the size of the local variable table attribute (VM stores raw):
coleenp@3345 186 // LocalVariableTable_attribute {
coleenp@3345 187 // u2 attribute_name_index;
coleenp@3345 188 // u4 attribute_length;
coleenp@3345 189 // u2 local_variable_table_length;
coleenp@3345 190 // {
coleenp@3345 191 // u2 start_pc;
coleenp@3345 192 // u2 length;
coleenp@3345 193 // u2 name_index;
coleenp@3345 194 // u2 descriptor_index;
coleenp@3345 195 // u2 index;
coleenp@3345 196 // }
coleenp@3345 197 attr_size += 2 + 4 + 2 + local_variable_table_length * (2 + 2 + 2 + 2 + 2);
minqi@4083 198
minqi@4083 199 // Local variables with generic signatures must have LVTT entries
minqi@4083 200 LocalVariableTableElement *elem = method->localvariable_table_start();
minqi@4083 201 for (int idx = 0; idx < local_variable_table_length; idx++) {
minqi@4083 202 if (elem[idx].signature_cp_index != 0) {
minqi@4083 203 local_variable_type_table_length++;
minqi@4083 204 }
minqi@4083 205 }
minqi@4083 206
minqi@4083 207 if (local_variable_type_table_length != 0) {
minqi@4083 208 ++attr_count;
minqi@4083 209 // Compute the size of the local variable type table attribute (VM stores raw):
minqi@4083 210 // LocalVariableTypeTable_attribute {
minqi@4083 211 // u2 attribute_name_index;
minqi@4083 212 // u4 attribute_length;
minqi@4083 213 // u2 local_variable_type_table_length;
minqi@4083 214 // {
minqi@4083 215 // u2 start_pc;
minqi@4083 216 // u2 length;
minqi@4083 217 // u2 name_index;
minqi@4083 218 // u2 signature_index;
minqi@4083 219 // u2 index;
minqi@4083 220 // }
minqi@4083 221 attr_size += 2 + 4 + 2 + local_variable_type_table_length * (2 + 2 + 2 + 2 + 2);
minqi@4083 222 }
coleenp@3345 223 }
coleenp@3345 224 }
duke@435 225
jiangli@3917 226 ExceptionTable exception_table(method());
jiangli@3917 227 int exception_table_length = exception_table.length();
duke@435 228 int code_size = const_method->code_size();
duke@435 229 int size =
duke@435 230 2+2+4 + // max_stack, max_locals, code_length
duke@435 231 code_size + // code
duke@435 232 2 + // exception_table_length
jiangli@3917 233 (2+2+2+2) * exception_table_length + // exception_table
duke@435 234 2 + // attributes_count
duke@435 235 attr_size; // attributes
duke@435 236
duke@435 237 write_attribute_name_index("Code");
duke@435 238 write_u4(size);
sspitsyn@4270 239 write_u2(method->verifier_max_stack());
duke@435 240 write_u2(method->max_locals());
duke@435 241 write_u4(code_size);
duke@435 242 copy_bytecodes(method, (unsigned char*)writeable_address(code_size));
jiangli@3917 243 write_u2(exception_table_length);
jiangli@3917 244 for (int index = 0; index < exception_table_length; index++) {
jiangli@3917 245 write_u2(exception_table.start_pc(index));
jiangli@3917 246 write_u2(exception_table.end_pc(index));
jiangli@3917 247 write_u2(exception_table.handler_pc(index));
jiangli@3917 248 write_u2(exception_table.catch_type_index(index));
duke@435 249 }
duke@435 250 write_u2(attr_count);
duke@435 251 if (line_num_cnt != 0) {
duke@435 252 write_line_number_table_attribute(method, line_num_cnt);
duke@435 253 }
duke@435 254 if (stackmap_len != 0) {
duke@435 255 write_stackmap_table_attribute(method, stackmap_len);
duke@435 256 }
coleenp@3345 257 if (local_variable_table_length != 0) {
coleenp@3345 258 write_local_variable_table_attribute(method, local_variable_table_length);
coleenp@3345 259 }
minqi@4083 260 if (local_variable_type_table_length != 0) {
minqi@4083 261 write_local_variable_type_table_attribute(method, local_variable_type_table_length);
minqi@4083 262 }
duke@435 263 }
duke@435 264
duke@435 265 // Write Exceptions attribute
duke@435 266 // JVMSpec| Exceptions_attribute {
duke@435 267 // JVMSpec| u2 attribute_name_index;
duke@435 268 // JVMSpec| u4 attribute_length;
duke@435 269 // JVMSpec| u2 number_of_exceptions;
duke@435 270 // JVMSpec| u2 exception_index_table[number_of_exceptions];
duke@435 271 // JVMSpec| }
coleenp@4037 272 void JvmtiClassFileReconstituter::write_exceptions_attribute(ConstMethod* const_method) {
duke@435 273 CheckedExceptionElement* checked_exceptions = const_method->checked_exceptions_start();
duke@435 274 int checked_exceptions_length = const_method->checked_exceptions_length();
duke@435 275 int size =
duke@435 276 2 + // number_of_exceptions
duke@435 277 2 * checked_exceptions_length; // exception_index_table
duke@435 278
duke@435 279 write_attribute_name_index("Exceptions");
duke@435 280 write_u4(size);
duke@435 281 write_u2(checked_exceptions_length);
duke@435 282 for (int index = 0; index < checked_exceptions_length; index++) {
duke@435 283 write_u2(checked_exceptions[index].class_cp_index);
duke@435 284 }
duke@435 285 }
duke@435 286
duke@435 287 // Write SourceFile attribute
duke@435 288 // JVMSpec| SourceFile_attribute {
duke@435 289 // JVMSpec| u2 attribute_name_index;
duke@435 290 // JVMSpec| u4 attribute_length;
duke@435 291 // JVMSpec| u2 sourcefile_index;
duke@435 292 // JVMSpec| }
duke@435 293 void JvmtiClassFileReconstituter::write_source_file_attribute() {
duke@435 294 assert(ikh()->source_file_name() != NULL, "caller must check");
duke@435 295
duke@435 296 write_attribute_name_index("SourceFile");
duke@435 297 write_u4(2); // always length 2
duke@435 298 write_u2(symbol_to_cpool_index(ikh()->source_file_name()));
duke@435 299 }
duke@435 300
duke@435 301 // Write SourceDebugExtension attribute
duke@435 302 // JSR45| SourceDebugExtension_attribute {
duke@435 303 // JSR45| u2 attribute_name_index;
duke@435 304 // JSR45| u4 attribute_length;
fparain@3906 305 // JSR45| u1 debug_extension[attribute_length];
duke@435 306 // JSR45| }
duke@435 307 void JvmtiClassFileReconstituter::write_source_debug_extension_attribute() {
duke@435 308 assert(ikh()->source_debug_extension() != NULL, "caller must check");
duke@435 309
duke@435 310 write_attribute_name_index("SourceDebugExtension");
fparain@3906 311 int len = (int)strlen(ikh()->source_debug_extension());
fparain@3906 312 write_u4(len);
fparain@3906 313 u1* ext = (u1*)ikh()->source_debug_extension();
fparain@3906 314 for (int i=0; i<len; i++) {
fparain@3906 315 write_u1(ext[i]);
fparain@3906 316 }
duke@435 317 }
duke@435 318
duke@435 319 // Write (generic) Signature attribute
duke@435 320 // JVMSpec| Signature_attribute {
duke@435 321 // JVMSpec| u2 attribute_name_index;
duke@435 322 // JVMSpec| u4 attribute_length;
duke@435 323 // JVMSpec| u2 signature_index;
duke@435 324 // JVMSpec| }
duke@435 325 void JvmtiClassFileReconstituter::write_signature_attribute(u2 generic_signature_index) {
duke@435 326 write_attribute_name_index("Signature");
duke@435 327 write_u4(2); // always length 2
duke@435 328 write_u2(generic_signature_index);
duke@435 329 }
duke@435 330
duke@435 331 // Compute the number of entries in the InnerClasses attribute
duke@435 332 u2 JvmtiClassFileReconstituter::inner_classes_attribute_length() {
jiangli@3670 333 InnerClassesIterator iter(ikh());
jiangli@3670 334 return iter.length();
duke@435 335 }
duke@435 336
duke@435 337 // Write an annotation attribute. The VM stores them in raw form, so all we need
duke@435 338 // to do is add the attrubute name and fill in the length.
duke@435 339 // JSR202| *Annotations_attribute {
duke@435 340 // JSR202| u2 attribute_name_index;
duke@435 341 // JSR202| u4 attribute_length;
duke@435 342 // JSR202| ...
duke@435 343 // JSR202| }
duke@435 344 void JvmtiClassFileReconstituter::write_annotations_attribute(const char* attr_name,
coleenp@4037 345 AnnotationArray* annos) {
duke@435 346 u4 length = annos->length();
duke@435 347 write_attribute_name_index(attr_name);
duke@435 348 write_u4(length);
coleenp@4037 349 memcpy(writeable_address(length), annos->adr_at(0), length);
duke@435 350 }
duke@435 351
sla@5058 352 // BootstrapMethods_attribute {
sla@5058 353 // u2 attribute_name_index;
sla@5058 354 // u4 attribute_length;
sla@5058 355 // u2 num_bootstrap_methods;
sla@5058 356 // { u2 bootstrap_method_ref;
sla@5058 357 // u2 num_bootstrap_arguments;
sla@5058 358 // u2 bootstrap_arguments[num_bootstrap_arguments];
sla@5058 359 // } bootstrap_methods[num_bootstrap_methods];
sla@5058 360 // }
sla@5060 361 void JvmtiClassFileReconstituter::write_bootstrapmethod_attribute() {
sla@5058 362 Array<u2>* operands = cpool()->operands();
sla@5058 363 write_attribute_name_index("BootstrapMethods");
sla@5058 364 int num_bootstrap_methods = ConstantPool::operand_array_length(operands);
sla@5058 365
sla@5058 366 // calculate length of attribute
sla@5060 367 int length = sizeof(u2); // num_bootstrap_methods
sla@5058 368 for (int n = 0; n < num_bootstrap_methods; n++) {
sla@5058 369 u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n);
sla@5058 370 length += sizeof(u2); // bootstrap_method_ref
sla@5058 371 length += sizeof(u2); // num_bootstrap_arguments
sla@5058 372 length += sizeof(u2) * num_bootstrap_arguments; // bootstrap_arguments[num_bootstrap_arguments]
sla@5058 373 }
sla@5058 374 write_u4(length);
sla@5058 375
sla@5058 376 // write attribute
sla@5058 377 write_u2(num_bootstrap_methods);
sla@5058 378 for (int n = 0; n < num_bootstrap_methods; n++) {
sla@5058 379 u2 bootstrap_method_ref = cpool()->operand_bootstrap_method_ref_index_at(n);
sla@5058 380 u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n);
sla@5058 381 write_u2(bootstrap_method_ref);
sla@5058 382 write_u2(num_bootstrap_arguments);
sla@5058 383 for (int arg = 0; arg < num_bootstrap_arguments; arg++) {
sla@5058 384 u2 bootstrap_argument = cpool()->operand_argument_index_at(n, arg);
sla@5058 385 write_u2(bootstrap_argument);
sla@5058 386 }
sla@5058 387 }
sla@5058 388 }
sla@5058 389
duke@435 390
duke@435 391 // Write InnerClasses attribute
duke@435 392 // JVMSpec| InnerClasses_attribute {
duke@435 393 // JVMSpec| u2 attribute_name_index;
duke@435 394 // JVMSpec| u4 attribute_length;
duke@435 395 // JVMSpec| u2 number_of_classes;
duke@435 396 // JVMSpec| { u2 inner_class_info_index;
duke@435 397 // JVMSpec| u2 outer_class_info_index;
duke@435 398 // JVMSpec| u2 inner_name_index;
duke@435 399 // JVMSpec| u2 inner_class_access_flags;
duke@435 400 // JVMSpec| } classes[number_of_classes];
duke@435 401 // JVMSpec| }
duke@435 402 void JvmtiClassFileReconstituter::write_inner_classes_attribute(int length) {
jiangli@3670 403 InnerClassesIterator iter(ikh());
jiangli@3670 404 guarantee(iter.length() != 0 && iter.length() == length,
duke@435 405 "caller must check");
coleenp@4037 406 u2 entry_count = length / InstanceKlass::inner_class_next_offset;
duke@435 407 u4 size = 2 + entry_count * (2+2+2+2);
duke@435 408
duke@435 409 write_attribute_name_index("InnerClasses");
duke@435 410 write_u4(size);
duke@435 411 write_u2(entry_count);
jiangli@3670 412 for (; !iter.done(); iter.next()) {
jiangli@3670 413 write_u2(iter.inner_class_info_index());
jiangli@3670 414 write_u2(iter.outer_class_info_index());
jiangli@3670 415 write_u2(iter.inner_name_index());
jiangli@3670 416 write_u2(iter.inner_access_flags());
duke@435 417 }
duke@435 418 }
duke@435 419
duke@435 420 // Write Synthetic attribute
duke@435 421 // JVMSpec| Synthetic_attribute {
duke@435 422 // JVMSpec| u2 attribute_name_index;
duke@435 423 // JVMSpec| u4 attribute_length;
duke@435 424 // JVMSpec| }
duke@435 425 void JvmtiClassFileReconstituter::write_synthetic_attribute() {
duke@435 426 write_attribute_name_index("Synthetic");
duke@435 427 write_u4(0); //length always zero
duke@435 428 }
duke@435 429
duke@435 430 // Compute size of LineNumberTable
duke@435 431 u2 JvmtiClassFileReconstituter::line_number_table_entries(methodHandle method) {
duke@435 432 // The line number table is compressed so we don't know how big it is until decompressed.
duke@435 433 // Decompression is really fast so we just do it twice.
duke@435 434 u2 num_entries = 0;
duke@435 435 CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
duke@435 436 while (stream.read_pair()) {
duke@435 437 num_entries++;
duke@435 438 }
duke@435 439 return num_entries;
duke@435 440 }
duke@435 441
duke@435 442 // Write LineNumberTable attribute
duke@435 443 // JVMSpec| LineNumberTable_attribute {
duke@435 444 // JVMSpec| u2 attribute_name_index;
duke@435 445 // JVMSpec| u4 attribute_length;
duke@435 446 // JVMSpec| u2 line_number_table_length;
duke@435 447 // JVMSpec| { u2 start_pc;
duke@435 448 // JVMSpec| u2 line_number;
duke@435 449 // JVMSpec| } line_number_table[line_number_table_length];
duke@435 450 // JVMSpec| }
duke@435 451 void JvmtiClassFileReconstituter::write_line_number_table_attribute(methodHandle method,
duke@435 452 u2 num_entries) {
duke@435 453
duke@435 454 write_attribute_name_index("LineNumberTable");
duke@435 455 write_u4(2 + num_entries * (2 + 2));
duke@435 456 write_u2(num_entries);
duke@435 457
duke@435 458 CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
duke@435 459 while (stream.read_pair()) {
duke@435 460 write_u2(stream.bci());
duke@435 461 write_u2(stream.line());
duke@435 462 }
duke@435 463 }
duke@435 464
minqi@4083 465 // Write LocalVariableTable attribute
coleenp@3345 466 // JVMSpec| LocalVariableTable_attribute {
coleenp@3345 467 // JVMSpec| u2 attribute_name_index;
coleenp@3345 468 // JVMSpec| u4 attribute_length;
coleenp@3345 469 // JVMSpec| u2 local_variable_table_length;
coleenp@3345 470 // JVMSpec| { u2 start_pc;
coleenp@3345 471 // JVMSpec| u2 length;
coleenp@3345 472 // JVMSpec| u2 name_index;
coleenp@3345 473 // JVMSpec| u2 descriptor_index;
coleenp@3345 474 // JVMSpec| u2 index;
coleenp@3345 475 // JVMSpec| } local_variable_table[local_variable_table_length];
coleenp@3345 476 // JVMSpec| }
coleenp@3345 477 void JvmtiClassFileReconstituter::write_local_variable_table_attribute(methodHandle method, u2 num_entries) {
coleenp@3345 478 write_attribute_name_index("LocalVariableTable");
coleenp@3345 479 write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2));
coleenp@3345 480 write_u2(num_entries);
coleenp@3345 481
coleenp@3345 482 assert(method->localvariable_table_length() == num_entries, "just checking");
coleenp@3345 483
coleenp@3345 484 LocalVariableTableElement *elem = method->localvariable_table_start();
coleenp@3345 485 for (int j=0; j<method->localvariable_table_length(); j++) {
coleenp@3345 486 write_u2(elem->start_bci);
coleenp@3345 487 write_u2(elem->length);
coleenp@3345 488 write_u2(elem->name_cp_index);
coleenp@3345 489 write_u2(elem->descriptor_cp_index);
coleenp@3345 490 write_u2(elem->slot);
coleenp@3345 491 elem++;
coleenp@3345 492 }
coleenp@3345 493 }
coleenp@3345 494
minqi@4083 495 // Write LocalVariableTypeTable attribute
minqi@4083 496 // JVMSpec| LocalVariableTypeTable_attribute {
minqi@4083 497 // JVMSpec| u2 attribute_name_index;
minqi@4083 498 // JVMSpec| u4 attribute_length;
minqi@4083 499 // JVMSpec| u2 local_variable_type_table_length;
minqi@4083 500 // JVMSpec| { u2 start_pc;
minqi@4083 501 // JVMSpec| u2 length;
minqi@4083 502 // JVMSpec| u2 name_index;
minqi@4083 503 // JVMSpec| u2 signature_index;
minqi@4083 504 // JVMSpec| u2 index;
minqi@4083 505 // JVMSpec| } local_variable_type_table[local_variable_type_table_length];
minqi@4083 506 // JVMSpec| }
minqi@4083 507 void JvmtiClassFileReconstituter::write_local_variable_type_table_attribute(methodHandle method, u2 num_entries) {
minqi@4083 508 write_attribute_name_index("LocalVariableTypeTable");
minqi@4083 509 write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2));
minqi@4083 510 write_u2(num_entries);
minqi@4083 511
minqi@4083 512 LocalVariableTableElement *elem = method->localvariable_table_start();
minqi@4083 513 for (int j=0; j<method->localvariable_table_length(); j++) {
minqi@4083 514 if (elem->signature_cp_index > 0) {
minqi@4083 515 // Local variable has a generic signature - write LVTT attribute entry
minqi@4083 516 write_u2(elem->start_bci);
minqi@4083 517 write_u2(elem->length);
minqi@4083 518 write_u2(elem->name_cp_index);
minqi@4083 519 write_u2(elem->signature_cp_index);
minqi@4083 520 write_u2(elem->slot);
minqi@4083 521 num_entries--;
minqi@4083 522 }
minqi@4083 523 elem++;
minqi@4083 524 }
minqi@4083 525 assert(num_entries == 0, "just checking");
minqi@4083 526 }
minqi@4083 527
duke@435 528 // Write stack map table attribute
duke@435 529 // JSR-202| StackMapTable_attribute {
duke@435 530 // JSR-202| u2 attribute_name_index;
duke@435 531 // JSR-202| u4 attribute_length;
duke@435 532 // JSR-202| u2 number_of_entries;
duke@435 533 // JSR-202| stack_map_frame_entries[number_of_entries];
duke@435 534 // JSR-202| }
duke@435 535 void JvmtiClassFileReconstituter::write_stackmap_table_attribute(methodHandle method,
duke@435 536 int stackmap_len) {
duke@435 537
duke@435 538 write_attribute_name_index("StackMapTable");
duke@435 539 write_u4(stackmap_len);
duke@435 540 memcpy(
duke@435 541 writeable_address(stackmap_len),
coleenp@4037 542 (void*)(method->stackmap_data()->adr_at(0)),
duke@435 543 stackmap_len);
duke@435 544 }
duke@435 545
duke@435 546 // Write one method_info structure
duke@435 547 // JVMSpec| method_info {
duke@435 548 // JVMSpec| u2 access_flags;
duke@435 549 // JVMSpec| u2 name_index;
duke@435 550 // JVMSpec| u2 descriptor_index;
duke@435 551 // JVMSpec| u2 attributes_count;
duke@435 552 // JVMSpec| attribute_info attributes[attributes_count];
duke@435 553 // JVMSpec| }
duke@435 554 void JvmtiClassFileReconstituter::write_method_info(methodHandle method) {
duke@435 555 AccessFlags access_flags = method->access_flags();
coleenp@4037 556 ConstMethod* const_method = method->constMethod();
duke@435 557 u2 generic_signature_index = const_method->generic_signature_index();
coleenp@4037 558 AnnotationArray* anno = method->annotations();
coleenp@4037 559 AnnotationArray* param_anno = method->parameter_annotations();
coleenp@4037 560 AnnotationArray* default_anno = method->annotation_default();
aeriksso@7327 561 AnnotationArray* type_anno = method->type_annotations();
duke@435 562
sla@5045 563 // skip generated default interface methods
sla@5045 564 if (method->is_overpass()) {
sla@5045 565 return;
sla@5045 566 }
sla@5045 567
duke@435 568 write_u2(access_flags.get_flags() & JVM_RECOGNIZED_METHOD_MODIFIERS);
duke@435 569 write_u2(const_method->name_index());
duke@435 570 write_u2(const_method->signature_index());
duke@435 571
duke@435 572 // write attributes in the same order javac does, so we can test with byte for
duke@435 573 // byte comparison
duke@435 574 int attr_count = 0;
duke@435 575 if (const_method->code_size() != 0) {
duke@435 576 ++attr_count; // has Code attribute
duke@435 577 }
duke@435 578 if (const_method->has_checked_exceptions()) {
duke@435 579 ++attr_count; // has Exceptions attribute
duke@435 580 }
coleenp@4037 581 if (default_anno != NULL) {
duke@435 582 ++attr_count; // has AnnotationDefault attribute
duke@435 583 }
duke@435 584 // Deprecated attribute would go here
duke@435 585 if (access_flags.is_synthetic()) { // FIXME
duke@435 586 // ++attr_count;
duke@435 587 }
duke@435 588 if (generic_signature_index != 0) {
duke@435 589 ++attr_count;
duke@435 590 }
coleenp@4037 591 if (anno != NULL) {
duke@435 592 ++attr_count; // has RuntimeVisibleAnnotations attribute
duke@435 593 }
coleenp@4037 594 if (param_anno != NULL) {
duke@435 595 ++attr_count; // has RuntimeVisibleParameterAnnotations attribute
duke@435 596 }
aeriksso@7327 597 if (type_anno != NULL) {
aeriksso@7327 598 ++attr_count; // has RuntimeVisibleTypeAnnotations attribute
aeriksso@7327 599 }
duke@435 600
duke@435 601 write_u2(attr_count);
duke@435 602 if (const_method->code_size() > 0) {
duke@435 603 write_code_attribute(method);
duke@435 604 }
duke@435 605 if (const_method->has_checked_exceptions()) {
duke@435 606 write_exceptions_attribute(const_method);
duke@435 607 }
coleenp@4037 608 if (default_anno != NULL) {
duke@435 609 write_annotations_attribute("AnnotationDefault", default_anno);
duke@435 610 }
duke@435 611 // Deprecated attribute would go here
duke@435 612 if (access_flags.is_synthetic()) {
duke@435 613 // write_synthetic_attribute();
duke@435 614 }
duke@435 615 if (generic_signature_index != 0) {
duke@435 616 write_signature_attribute(generic_signature_index);
duke@435 617 }
coleenp@4037 618 if (anno != NULL) {
duke@435 619 write_annotations_attribute("RuntimeVisibleAnnotations", anno);
duke@435 620 }
coleenp@4037 621 if (param_anno != NULL) {
duke@435 622 write_annotations_attribute("RuntimeVisibleParameterAnnotations", param_anno);
duke@435 623 }
aeriksso@7327 624 if (type_anno != NULL) {
aeriksso@7327 625 write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
aeriksso@7327 626 }
duke@435 627 }
duke@435 628
duke@435 629 // Write the class attributes portion of ClassFile structure
duke@435 630 // JVMSpec| u2 attributes_count;
duke@435 631 // JVMSpec| attribute_info attributes[attributes_count];
duke@435 632 void JvmtiClassFileReconstituter::write_class_attributes() {
duke@435 633 u2 inner_classes_length = inner_classes_attribute_length();
coleenp@2497 634 Symbol* generic_signature = ikh()->generic_signature();
coleenp@4037 635 AnnotationArray* anno = ikh()->class_annotations();
aeriksso@7327 636 AnnotationArray* type_anno = ikh()->class_type_annotations();
duke@435 637
duke@435 638 int attr_count = 0;
coleenp@2497 639 if (generic_signature != NULL) {
duke@435 640 ++attr_count;
duke@435 641 }
duke@435 642 if (ikh()->source_file_name() != NULL) {
duke@435 643 ++attr_count;
duke@435 644 }
duke@435 645 if (ikh()->source_debug_extension() != NULL) {
duke@435 646 ++attr_count;
duke@435 647 }
duke@435 648 if (inner_classes_length > 0) {
duke@435 649 ++attr_count;
duke@435 650 }
coleenp@4037 651 if (anno != NULL) {
duke@435 652 ++attr_count; // has RuntimeVisibleAnnotations attribute
duke@435 653 }
aeriksso@7327 654 if (type_anno != NULL) {
aeriksso@7327 655 ++attr_count; // has RuntimeVisibleTypeAnnotations attribute
aeriksso@7327 656 }
sla@5058 657 if (cpool()->operands() != NULL) {
sla@5058 658 ++attr_count;
sla@5058 659 }
duke@435 660
duke@435 661 write_u2(attr_count);
duke@435 662
coleenp@2497 663 if (generic_signature != NULL) {
coleenp@2497 664 write_signature_attribute(symbol_to_cpool_index(generic_signature));
duke@435 665 }
duke@435 666 if (ikh()->source_file_name() != NULL) {
duke@435 667 write_source_file_attribute();
duke@435 668 }
duke@435 669 if (ikh()->source_debug_extension() != NULL) {
duke@435 670 write_source_debug_extension_attribute();
duke@435 671 }
duke@435 672 if (inner_classes_length > 0) {
duke@435 673 write_inner_classes_attribute(inner_classes_length);
duke@435 674 }
coleenp@4037 675 if (anno != NULL) {
duke@435 676 write_annotations_attribute("RuntimeVisibleAnnotations", anno);
duke@435 677 }
aeriksso@7327 678 if (type_anno != NULL) {
aeriksso@7327 679 write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
aeriksso@7327 680 }
sla@5058 681 if (cpool()->operands() != NULL) {
sla@5060 682 write_bootstrapmethod_attribute();
sla@5058 683 }
duke@435 684 }
duke@435 685
duke@435 686 // Write the method information portion of ClassFile structure
duke@435 687 // JVMSpec| u2 methods_count;
duke@435 688 // JVMSpec| method_info methods[methods_count];
duke@435 689 void JvmtiClassFileReconstituter::write_method_infos() {
duke@435 690 HandleMark hm(thread());
coleenp@4037 691 Array<Method*>* methods = ikh()->methods();
duke@435 692 int num_methods = methods->length();
sla@5045 693 int num_overpass = 0;
duke@435 694
sla@5045 695 // count the generated default interface methods
sla@5045 696 // these will not be re-created by write_method_info
sla@5045 697 // and should not be included in the total count
sla@5045 698 for (int index = 0; index < num_methods; index++) {
sla@5045 699 Method* method = methods->at(index);
sla@5045 700 if (method->is_overpass()) {
sla@5045 701 num_overpass++;
sla@5045 702 }
sla@5045 703 }
sla@5045 704
sla@5045 705 write_u2(num_methods - num_overpass);
duke@435 706 if (JvmtiExport::can_maintain_original_method_order()) {
duke@435 707 int index;
duke@435 708 int original_index;
coleenp@4037 709 intArray method_order(num_methods, 0);
duke@435 710
duke@435 711 // invert the method order mapping
duke@435 712 for (index = 0; index < num_methods; index++) {
coleenp@4037 713 original_index = ikh()->method_ordering()->at(index);
duke@435 714 assert(original_index >= 0 && original_index < num_methods,
duke@435 715 "invalid original method index");
coleenp@4037 716 method_order.at_put(original_index, index);
duke@435 717 }
duke@435 718
duke@435 719 // write in original order
duke@435 720 for (original_index = 0; original_index < num_methods; original_index++) {
coleenp@4037 721 index = method_order.at(original_index);
coleenp@4037 722 methodHandle method(thread(), methods->at(index));
duke@435 723 write_method_info(method);
duke@435 724 }
duke@435 725 } else {
duke@435 726 // method order not preserved just dump the method infos
duke@435 727 for (int index = 0; index < num_methods; index++) {
coleenp@4037 728 methodHandle method(thread(), methods->at(index));
duke@435 729 write_method_info(method);
duke@435 730 }
duke@435 731 }
duke@435 732 }
duke@435 733
duke@435 734 void JvmtiClassFileReconstituter::write_class_file_format() {
duke@435 735 ReallocMark();
duke@435 736
duke@435 737 // JVMSpec| ClassFile {
duke@435 738 // JVMSpec| u4 magic;
duke@435 739 write_u4(0xCAFEBABE);
duke@435 740
duke@435 741 // JVMSpec| u2 minor_version;
duke@435 742 // JVMSpec| u2 major_version;
duke@435 743 write_u2(ikh()->minor_version());
duke@435 744 u2 major = ikh()->major_version();
duke@435 745 write_u2(major);
duke@435 746
duke@435 747 // JVMSpec| u2 constant_pool_count;
duke@435 748 // JVMSpec| cp_info constant_pool[constant_pool_count-1];
duke@435 749 write_u2(cpool()->length());
duke@435 750 copy_cpool_bytes(writeable_address(cpool_size()));
duke@435 751
duke@435 752 // JVMSpec| u2 access_flags;
duke@435 753 write_u2(ikh()->access_flags().get_flags() & JVM_RECOGNIZED_CLASS_MODIFIERS);
duke@435 754
duke@435 755 // JVMSpec| u2 this_class;
duke@435 756 // JVMSpec| u2 super_class;
duke@435 757 write_u2(class_symbol_to_cpool_index(ikh()->name()));
coleenp@4037 758 Klass* super_class = ikh()->super();
duke@435 759 write_u2(super_class == NULL? 0 : // zero for java.lang.Object
coleenp@4037 760 class_symbol_to_cpool_index(super_class->name()));
duke@435 761
duke@435 762 // JVMSpec| u2 interfaces_count;
duke@435 763 // JVMSpec| u2 interfaces[interfaces_count];
coleenp@4037 764 Array<Klass*>* interfaces = ikh()->local_interfaces();
duke@435 765 int num_interfaces = interfaces->length();
duke@435 766 write_u2(num_interfaces);
duke@435 767 for (int index = 0; index < num_interfaces; index++) {
duke@435 768 HandleMark hm(thread());
coleenp@4037 769 instanceKlassHandle iikh(thread(), interfaces->at(index));
duke@435 770 write_u2(class_symbol_to_cpool_index(iikh->name()));
duke@435 771 }
duke@435 772
duke@435 773 // JVMSpec| u2 fields_count;
duke@435 774 // JVMSpec| field_info fields[fields_count];
duke@435 775 write_field_infos();
duke@435 776
duke@435 777 // JVMSpec| u2 methods_count;
duke@435 778 // JVMSpec| method_info methods[methods_count];
duke@435 779 write_method_infos();
duke@435 780
duke@435 781 // JVMSpec| u2 attributes_count;
duke@435 782 // JVMSpec| attribute_info attributes[attributes_count];
duke@435 783 // JVMSpec| } /* end ClassFile 8?
duke@435 784 write_class_attributes();
duke@435 785 }
duke@435 786
duke@435 787 address JvmtiClassFileReconstituter::writeable_address(size_t size) {
duke@435 788 size_t used_size = _buffer_ptr - _buffer;
duke@435 789 if (size + used_size >= _buffer_size) {
duke@435 790 // compute the new buffer size: must be at least twice as big as before
duke@435 791 // plus whatever new is being used; then convert to nice clean block boundary
duke@435 792 size_t new_buffer_size = (size + _buffer_size*2 + 1) / initial_buffer_size
duke@435 793 * initial_buffer_size;
duke@435 794
duke@435 795 // VM goes belly-up if the memory isn't available, so cannot do OOM processing
duke@435 796 _buffer = REALLOC_RESOURCE_ARRAY(u1, _buffer, _buffer_size, new_buffer_size);
duke@435 797 _buffer_size = new_buffer_size;
duke@435 798 _buffer_ptr = _buffer + used_size;
duke@435 799 }
duke@435 800 u1* ret_ptr = _buffer_ptr;
duke@435 801 _buffer_ptr += size;
duke@435 802 return ret_ptr;
duke@435 803 }
duke@435 804
duke@435 805 void JvmtiClassFileReconstituter::write_attribute_name_index(const char* name) {
coleenp@2497 806 TempNewSymbol sym = SymbolTable::probe(name, (int)strlen(name));
duke@435 807 assert(sym != NULL, "attribute name symbol not found");
duke@435 808 u2 attr_name_index = symbol_to_cpool_index(sym);
duke@435 809 assert(attr_name_index != 0, "attribute name symbol not in constant pool");
duke@435 810 write_u2(attr_name_index);
duke@435 811 }
duke@435 812
duke@435 813 void JvmtiClassFileReconstituter::write_u1(u1 x) {
duke@435 814 *writeable_address(1) = x;
duke@435 815 }
duke@435 816
duke@435 817 void JvmtiClassFileReconstituter::write_u2(u2 x) {
duke@435 818 Bytes::put_Java_u2(writeable_address(2), x);
duke@435 819 }
duke@435 820
duke@435 821 void JvmtiClassFileReconstituter::write_u4(u4 x) {
duke@435 822 Bytes::put_Java_u4(writeable_address(4), x);
duke@435 823 }
duke@435 824
duke@435 825 void JvmtiClassFileReconstituter::write_u8(u8 x) {
duke@435 826 Bytes::put_Java_u8(writeable_address(8), x);
duke@435 827 }
duke@435 828
duke@435 829 void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
duke@435 830 unsigned char* bytecodes) {
duke@435 831 // use a BytecodeStream to iterate over the bytecodes. JVM/fast bytecodes
duke@435 832 // and the breakpoint bytecode are converted to their original bytecodes.
duke@435 833
duke@435 834 BytecodeStream bs(mh);
duke@435 835
duke@435 836 unsigned char* p = bytecodes;
duke@435 837 Bytecodes::Code code;
coleenp@4251 838 bool is_rewritten = mh->method_holder()->is_rewritten();
duke@435 839
duke@435 840 while ((code = bs.next()) >= 0) {
duke@435 841 assert(Bytecodes::is_java_code(code), "sanity check");
duke@435 842 assert(code != Bytecodes::_breakpoint, "sanity check");
duke@435 843
duke@435 844 // length of bytecode (mnemonic + operands)
duke@435 845 address bcp = bs.bcp();
jrose@1920 846 int len = bs.instruction_size();
duke@435 847 assert(len > 0, "length must be > 0");
duke@435 848
duke@435 849 // copy the bytecodes
duke@435 850 *p = (unsigned char) (bs.is_wide()? Bytecodes::_wide : code);
duke@435 851 if (len > 1) {
duke@435 852 memcpy(p+1, bcp+1, len-1);
duke@435 853 }
duke@435 854
duke@435 855 // During linking the get/put and invoke instructions are rewritten
duke@435 856 // with an index into the constant pool cache. The original constant
duke@435 857 // pool index must be returned to caller. Rewrite the index.
coleenp@4037 858 if (is_rewritten && len > 1) {
coleenp@4037 859 bool is_wide = false;
duke@435 860 switch (code) {
duke@435 861 case Bytecodes::_getstatic : // fall through
duke@435 862 case Bytecodes::_putstatic : // fall through
duke@435 863 case Bytecodes::_getfield : // fall through
duke@435 864 case Bytecodes::_putfield : // fall through
duke@435 865 case Bytecodes::_invokevirtual : // fall through
duke@435 866 case Bytecodes::_invokespecial : // fall through
duke@435 867 case Bytecodes::_invokestatic : // fall through
jrose@1161 868 case Bytecodes::_invokedynamic : // fall through
coleenp@4037 869 case Bytecodes::_invokeinterface : {
dsamersoff@3626 870 assert(len == 3 ||
dsamersoff@3626 871 (code == Bytecodes::_invokeinterface && len == 5) ||
dsamersoff@3626 872 (code == Bytecodes::_invokedynamic && len == 5),
duke@435 873 "sanity check");
dsamersoff@3626 874
jrose@1161 875 int cpci = Bytes::get_native_u2(bcp+1);
jrose@1161 876 bool is_invokedynamic = (EnableInvokeDynamic && code == Bytecodes::_invokedynamic);
coleenp@4037 877 ConstantPoolCacheEntry* entry;
coleenp@4037 878 if (is_invokedynamic) {
jrose@1161 879 cpci = Bytes::get_native_u4(bcp+1);
coleenp@4037 880 entry = mh->constants()->invokedynamic_cp_cache_entry_at(cpci);
coleenp@4037 881 } else {
duke@435 882 // cache cannot be pre-fetched since some classes won't have it yet
coleenp@4037 883 entry = mh->constants()->cache()->entry_at(cpci);
coleenp@4037 884 }
duke@435 885 int i = entry->constant_pool_index();
duke@435 886 assert(i < mh->constants()->length(), "sanity check");
duke@435 887 Bytes::put_Java_u2((address)(p+1), (u2)i); // java byte ordering
jrose@1161 888 if (is_invokedynamic) *(p+3) = *(p+4) = 0;
duke@435 889 break;
duke@435 890 }
coleenp@4037 891 case Bytecodes::_ldc_w:
coleenp@4037 892 is_wide = true; // fall through
coleenp@4037 893 case Bytecodes::_ldc: {
coleenp@4037 894 if (bs.raw_code() == Bytecodes::_fast_aldc || bs.raw_code() == Bytecodes::_fast_aldc_w) {
coleenp@4037 895 int cpci = is_wide ? Bytes::get_native_u2(bcp+1) : (u1)(*(bcp+1));
coleenp@4037 896 int i = mh->constants()->object_to_cp_index(cpci);
coleenp@4037 897 assert(i < mh->constants()->length(), "sanity check");
coleenp@4037 898 if (is_wide) {
coleenp@4037 899 Bytes::put_Java_u2((address)(p+1), (u2)i); // java byte ordering
coleenp@4037 900 } else {
coleenp@4037 901 *(p+1) = (u1)i;
coleenp@4037 902 }
coleenp@4037 903 }
coleenp@4037 904 break;
coleenp@4037 905 }
coleenp@4037 906 }
duke@435 907 }
duke@435 908
duke@435 909 p += len;
duke@435 910 }
duke@435 911 }

mercurial