comparison src/share/vm/classfile/symbolTable.cpp @ 4283:0ede345ec7c9

8009829: CDS: JDK JPRT test fails crash in Symbol::equals() Summary: -Xshare:dump was creating a Symbol in C_heap. There's an assert there that jdk jprt wasn't hitting because it was only done in product Reviewed-by: dholmes, hseigel, iklam
author coleenp
date Wed, 13 Mar 2013 15:15:56 -0400
parents 2aa953165ade
children ede380e13960
comparison
equal deleted inserted replaced
16:73660d6a1c1c 17:0e9983253387
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, 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.
47 Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS) { 47 Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS) {
48 assert (len <= Symbol::max_length(), "should be checked by caller"); 48 assert (len <= Symbol::max_length(), "should be checked by caller");
49 49
50 Symbol* sym; 50 Symbol* sym;
51 51
52 if (c_heap) { 52 if (DumpSharedSpaces) {
53 // Allocate all symbols to CLD shared metaspace
54 sym = new (len, ClassLoaderData::the_null_class_loader_data(), THREAD) Symbol(name, len, -1);
55 } else if (c_heap) {
53 // refcount starts as 1 56 // refcount starts as 1
54 assert(!DumpSharedSpaces, "never allocate to C heap");
55 sym = new (len, THREAD) Symbol(name, len, 1); 57 sym = new (len, THREAD) Symbol(name, len, 1);
56 assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted"); 58 assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
57 } else { 59 } else {
58 if (DumpSharedSpaces) { 60 // Allocate to global arena
59 sym = new (len, ClassLoaderData::the_null_class_loader_data(), THREAD) Symbol(name, len, -1);
60 } else {
61 sym = new (len, arena(), THREAD) Symbol(name, len, -1); 61 sym = new (len, arena(), THREAD) Symbol(name, len, -1);
62 }
63 } 62 }
64 return sym; 63 return sym;
65 } 64 }
66 65
67 void SymbolTable::initialize_symbols(int arena_alloc_size) { 66 void SymbolTable::initialize_symbols(int arena_alloc_size) {