Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/classFileParser.cpp @ 5979:fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
Summary: Move symbol allocation to an arena so NMT doesn't have to track them at startup.
Reviewed-by: never, kamg, zgu
author | coleenp |
---|---|
date | Fri, 23 Mar 2012 11:16:05 -0400 |
parents | 2b3acb34791f |
children | 749b1464aa81 |
comparison
equal
deleted
inserted
replaced
5978:51612f0c0a79 | 5979:fc9d8850ab8b |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
79 // Used for backward compatibility reasons: | 79 // Used for backward compatibility reasons: |
80 // - to check NameAndType_info signatures more aggressively | 80 // - to check NameAndType_info signatures more aggressively |
81 #define JAVA_7_VERSION 51 | 81 #define JAVA_7_VERSION 51 |
82 | 82 |
83 | 83 |
84 void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int length, TRAPS) { | 84 void ClassFileParser::parse_constant_pool_entries(Handle class_loader, constantPoolHandle cp, int length, TRAPS) { |
85 // Use a local copy of ClassFileStream. It helps the C++ compiler to optimize | 85 // Use a local copy of ClassFileStream. It helps the C++ compiler to optimize |
86 // this function (_current can be allocated in a register, with scalar | 86 // this function (_current can be allocated in a register, with scalar |
87 // replacement of aggregates). The _current pointer is copied back to | 87 // replacement of aggregates). The _current pointer is copied back to |
88 // stream() when this function returns. DON'T call another method within | 88 // stream() when this function returns. DON'T call another method within |
89 // this method that uses stream(). | 89 // this method that uses stream(). |
270 names[names_count] = (char*)utf8_buffer; | 270 names[names_count] = (char*)utf8_buffer; |
271 lengths[names_count] = utf8_length; | 271 lengths[names_count] = utf8_length; |
272 indices[names_count] = index; | 272 indices[names_count] = index; |
273 hashValues[names_count++] = hash; | 273 hashValues[names_count++] = hash; |
274 if (names_count == SymbolTable::symbol_alloc_batch_size) { | 274 if (names_count == SymbolTable::symbol_alloc_batch_size) { |
275 SymbolTable::new_symbols(cp, names_count, names, lengths, indices, hashValues, CHECK); | 275 SymbolTable::new_symbols(class_loader, cp, names_count, names, lengths, indices, hashValues, CHECK); |
276 names_count = 0; | 276 names_count = 0; |
277 } | 277 } |
278 } else { | 278 } else { |
279 cp->symbol_at_put(index, result); | 279 cp->symbol_at_put(index, result); |
280 } | 280 } |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 // Allocate the remaining symbols | 290 // Allocate the remaining symbols |
291 if (names_count > 0) { | 291 if (names_count > 0) { |
292 SymbolTable::new_symbols(cp, names_count, names, lengths, indices, hashValues, CHECK); | 292 SymbolTable::new_symbols(class_loader, cp, names_count, names, lengths, indices, hashValues, CHECK); |
293 } | 293 } |
294 | 294 |
295 // Copy _current pointer of local copy back to stream(). | 295 // Copy _current pointer of local copy back to stream(). |
296 #ifdef ASSERT | 296 #ifdef ASSERT |
297 assert(cfs0->current() == old_current, "non-exclusive use of stream()"); | 297 assert(cfs0->current() == old_current, "non-exclusive use of stream()"); |
316 void set_in_error(bool clean) { _in_error = clean; } | 316 void set_in_error(bool clean) { _in_error = clean; } |
317 }; | 317 }; |
318 | 318 |
319 bool inline valid_cp_range(int index, int length) { return (index > 0 && index < length); } | 319 bool inline valid_cp_range(int index, int length) { return (index > 0 && index < length); } |
320 | 320 |
321 constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { | 321 constantPoolHandle ClassFileParser::parse_constant_pool(Handle class_loader, TRAPS) { |
322 ClassFileStream* cfs = stream(); | 322 ClassFileStream* cfs = stream(); |
323 constantPoolHandle nullHandle; | 323 constantPoolHandle nullHandle; |
324 | 324 |
325 cfs->guarantee_more(3, CHECK_(nullHandle)); // length, first cp tag | 325 cfs->guarantee_more(3, CHECK_(nullHandle)); // length, first cp tag |
326 u2 length = cfs->get_u2_fast(); | 326 u2 length = cfs->get_u2_fast(); |
335 | 335 |
336 cp->set_partially_loaded(); // Enables heap verify to work on partial constantPoolOops | 336 cp->set_partially_loaded(); // Enables heap verify to work on partial constantPoolOops |
337 ConstantPoolCleaner cp_in_error(cp); // set constant pool to be cleaned up. | 337 ConstantPoolCleaner cp_in_error(cp); // set constant pool to be cleaned up. |
338 | 338 |
339 // parsing constant pool entries | 339 // parsing constant pool entries |
340 parse_constant_pool_entries(cp, length, CHECK_(nullHandle)); | 340 parse_constant_pool_entries(class_loader, cp, length, CHECK_(nullHandle)); |
341 | 341 |
342 int index = 1; // declared outside of loops for portability | 342 int index = 1; // declared outside of loops for portability |
343 | 343 |
344 // first verification pass - validate cross references and fixup class and string constants | 344 // first verification pass - validate cross references and fixup class and string constants |
345 for (index = 1; index < length; index++) { // Index 0 is unused | 345 for (index = 1; index < length; index++) { // Index 0 is unused |
2756 // Check if verification needs to be relaxed for this class file | 2756 // Check if verification needs to be relaxed for this class file |
2757 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376) | 2757 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376) |
2758 _relax_verify = Verifier::relax_verify_for(class_loader()); | 2758 _relax_verify = Verifier::relax_verify_for(class_loader()); |
2759 | 2759 |
2760 // Constant pool | 2760 // Constant pool |
2761 constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle)); | 2761 constantPoolHandle cp = parse_constant_pool(class_loader, CHECK_(nullHandle)); |
2762 ConstantPoolCleaner error_handler(cp); // set constant pool to be cleaned up. | 2762 ConstantPoolCleaner error_handler(cp); // set constant pool to be cleaned up. |
2763 | 2763 |
2764 int cp_size = cp->length(); | 2764 int cp_size = cp->length(); |
2765 | 2765 |
2766 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len | 2766 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len |