comparison src/share/vm/classfile/symbolTable.hpp @ 2491:0654ee04b214

Merge with OpenJDK.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 22 Apr 2011 15:30:53 +0200
parents 352622fd140a
children 94ec88ca68e2
comparison
equal deleted inserted replaced
2490:29246b1d2d3c 2491:0654ee04b214
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, 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.
214 214
215 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS); 215 static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
216 oop basic_add(int index, Handle string_or_null, jchar* name, int len, 216 oop basic_add(int index, Handle string_or_null, jchar* name, int len,
217 unsigned int hashValue, TRAPS); 217 unsigned int hashValue, TRAPS);
218 218
219 // Table size
220 enum {
221 string_table_size = 1009
222 };
223
224 oop lookup(int index, jchar* chars, int length, unsigned int hashValue); 219 oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
225 220
226 StringTable() : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>)) {} 221 StringTable() : Hashtable<oop>((int)StringTableSize,
222 sizeof (HashtableEntry<oop>)) {}
227 223
228 StringTable(HashtableBucket* t, int number_of_entries) 224 StringTable(HashtableBucket* t, int number_of_entries)
229 : Hashtable<oop>(string_table_size, sizeof (HashtableEntry<oop>), t, 225 : Hashtable<oop>((int)StringTableSize, sizeof (HashtableEntry<oop>), t,
230 number_of_entries) {} 226 number_of_entries) {}
231 227
232 public: 228 public:
233 // The string table 229 // The string table
234 static StringTable* the_table() { return _the_table; } 230 static StringTable* the_table() { return _the_table; }
235 231
239 } 235 }
240 236
241 static void create_table(HashtableBucket* t, int length, 237 static void create_table(HashtableBucket* t, int length,
242 int number_of_entries) { 238 int number_of_entries) {
243 assert(_the_table == NULL, "One string table allowed."); 239 assert(_the_table == NULL, "One string table allowed.");
244 assert(length == string_table_size * sizeof(HashtableBucket), 240 assert((size_t)length == StringTableSize * sizeof(HashtableBucket),
245 "bad shared string size."); 241 "bad shared string size.");
246 _the_table = new StringTable(t, number_of_entries); 242 _the_table = new StringTable(t, number_of_entries);
247 } 243 }
248
249 static int hash_string(jchar* s, int len);
250 244
251 // GC support 245 // GC support
252 // Delete pointers to otherwise-unreachable objects. 246 // Delete pointers to otherwise-unreachable objects.
253 static void unlink(BoolObjectClosure* cl); 247 static void unlink(BoolObjectClosure* cl);
254 248