equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2019, 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. |
82 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); |
82 assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); |
83 |
83 |
84 if (!UseSharedSpaces) { |
84 if (!UseSharedSpaces) { |
85 const char* string = &vm_symbol_bodies[0]; |
85 const char* string = &vm_symbol_bodies[0]; |
86 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
86 for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
87 Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK); |
87 Symbol* sym = SymbolTable::new_permanent_symbol(string); |
88 _symbols[index] = sym; |
88 _symbols[index] = sym; |
89 string += strlen(string); // skip string body |
89 string += strlen(string); // skip string body |
90 string += 1; // skip trailing null |
90 string += 1; // skip trailing null |
91 } |
91 } |
92 |
92 |
139 #ifdef ASSERT |
139 #ifdef ASSERT |
140 { |
140 { |
141 // Spot-check correspondence between strings, symbols, and enums: |
141 // Spot-check correspondence between strings, symbols, and enums: |
142 assert(_symbols[NO_SID] == NULL, "must be"); |
142 assert(_symbols[NO_SID] == NULL, "must be"); |
143 const char* str = "java/lang/Object"; |
143 const char* str = "java/lang/Object"; |
144 TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str, CHECK); |
144 TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str); |
145 assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, ""); |
145 assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, ""); |
146 assert(jlo == java_lang_Object(), ""); |
146 assert(jlo == java_lang_Object(), ""); |
147 SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object); |
147 SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object); |
148 assert(find_sid(jlo) == sid, ""); |
148 assert(find_sid(jlo) == sid, ""); |
149 assert(symbol_at(sid) == jlo, ""); |
149 assert(symbol_at(sid) == jlo, ""); |
158 } |
158 } |
159 |
159 |
160 // The string "format" happens (at the moment) not to be a vmSymbol, |
160 // The string "format" happens (at the moment) not to be a vmSymbol, |
161 // though it is a method name in java.lang.String. |
161 // though it is a method name in java.lang.String. |
162 str = "format"; |
162 str = "format"; |
163 TempNewSymbol fmt = SymbolTable::new_permanent_symbol(str, CHECK); |
163 TempNewSymbol fmt = SymbolTable::new_permanent_symbol(str); |
164 sid = find_sid(fmt); |
164 sid = find_sid(fmt); |
165 assert(sid == NO_SID, "symbol index works (negative test)"); |
165 assert(sid == NO_SID, "symbol index works (negative test)"); |
166 } |
166 } |
167 #endif |
167 #endif |
168 } |
168 } |