Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/vmSymbols.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 | 72dee110246f |
children | 1d7922586cf6 |
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. |
77 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); | 77 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); |
78 | 78 |
79 if (!UseSharedSpaces) { | 79 if (!UseSharedSpaces) { |
80 const char* string = &vm_symbol_bodies[0]; | 80 const char* string = &vm_symbol_bodies[0]; |
81 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { | 81 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
82 Symbol* sym = SymbolTable::new_symbol(string, CHECK); | 82 Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK); |
83 _symbols[index] = sym; | 83 _symbols[index] = sym; |
84 string += strlen(string); // skip string body | 84 string += strlen(string); // skip string body |
85 string += 1; // skip trailing null | 85 string += 1; // skip trailing null |
86 } | 86 } |
87 | 87 |
126 #ifdef ASSERT | 126 #ifdef ASSERT |
127 { | 127 { |
128 // Spot-check correspondence between strings, symbols, and enums: | 128 // Spot-check correspondence between strings, symbols, and enums: |
129 assert(_symbols[NO_SID] == NULL, "must be"); | 129 assert(_symbols[NO_SID] == NULL, "must be"); |
130 const char* str = "java/lang/Object"; | 130 const char* str = "java/lang/Object"; |
131 TempNewSymbol jlo = SymbolTable::new_symbol(str, CHECK); | 131 TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str, CHECK); |
132 assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, ""); | 132 assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, ""); |
133 assert(jlo == java_lang_Object(), ""); | 133 assert(jlo == java_lang_Object(), ""); |
134 SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object); | 134 SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object); |
135 assert(find_sid(jlo) == sid, ""); | 135 assert(find_sid(jlo) == sid, ""); |
136 assert(symbol_at(sid) == jlo, ""); | 136 assert(symbol_at(sid) == jlo, ""); |
145 } | 145 } |
146 | 146 |
147 // The string "format" happens (at the moment) not to be a vmSymbol, | 147 // The string "format" happens (at the moment) not to be a vmSymbol, |
148 // though it is a method name in java.lang.String. | 148 // though it is a method name in java.lang.String. |
149 str = "format"; | 149 str = "format"; |
150 TempNewSymbol fmt = SymbolTable::new_symbol(str, CHECK); | 150 TempNewSymbol fmt = SymbolTable::new_permanent_symbol(str, CHECK); |
151 sid = find_sid(fmt); | 151 sid = find_sid(fmt); |
152 assert(sid == NO_SID, "symbol index works (negative test)"); | 152 assert(sid == NO_SID, "symbol index works (negative test)"); |
153 } | 153 } |
154 #endif | 154 #endif |
155 } | 155 } |