mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
7150058: Allocate symbols from null boot loader to an arena for NMT
Move symbol allocation to an arena so NMT doesn't have to track them at startup. Reviewed-by: never, kamg, zgu
This commit is contained in:
parent
2c07f4154e
commit
1431a5efd1
11 changed files with 162 additions and 126 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -82,24 +82,24 @@ private:
|
|||
static int symbols_removed;
|
||||
static int symbols_counted;
|
||||
|
||||
Symbol* allocate_symbol(const u1* name, int len, TRAPS); // Assumes no characters larger than 0x7F
|
||||
bool allocate_symbols(int names_count, const u1** names, int* lengths, Symbol** syms, TRAPS);
|
||||
Symbol* allocate_symbol(const u1* name, int len, bool c_heap, TRAPS); // Assumes no characters larger than 0x7F
|
||||
|
||||
// Adding elements
|
||||
Symbol* basic_add(int index, u1* name, int len,
|
||||
unsigned int hashValue, TRAPS);
|
||||
bool basic_add(constantPoolHandle cp, int names_count,
|
||||
Symbol* basic_add(int index, u1* name, int len, unsigned int hashValue,
|
||||
bool c_heap, TRAPS);
|
||||
|
||||
bool basic_add(Handle class_loader, constantPoolHandle cp, int names_count,
|
||||
const char** names, int* lengths, int* cp_indices,
|
||||
unsigned int* hashValues, TRAPS);
|
||||
|
||||
static void new_symbols(constantPoolHandle cp, int names_count,
|
||||
static void new_symbols(Handle class_loader, constantPoolHandle cp,
|
||||
int names_count,
|
||||
const char** name, int* lengths,
|
||||
int* cp_indices, unsigned int* hashValues,
|
||||
TRAPS) {
|
||||
add(cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
|
||||
add(class_loader, cp, names_count, name, lengths, cp_indices, hashValues, THREAD);
|
||||
}
|
||||
|
||||
|
||||
// Table size
|
||||
enum {
|
||||
symbol_table_size = 20011
|
||||
|
@ -114,10 +114,16 @@ private:
|
|||
: Hashtable<Symbol*>(symbol_table_size, sizeof (HashtableEntry<Symbol*>), t,
|
||||
number_of_entries) {}
|
||||
|
||||
// Arena for permanent symbols (null class loader) that are never unloaded
|
||||
static Arena* _arena;
|
||||
static Arena* arena() { return _arena; } // called for statistics
|
||||
|
||||
static void initialize_symbols(int arena_alloc_size = 0);
|
||||
public:
|
||||
enum {
|
||||
symbol_alloc_batch_size = 8
|
||||
symbol_alloc_batch_size = 8,
|
||||
// Pick initial size based on java -version size measurements
|
||||
symbol_alloc_arena_size = 360*K
|
||||
};
|
||||
|
||||
// The symbol table
|
||||
|
@ -126,6 +132,7 @@ public:
|
|||
static void create_table() {
|
||||
assert(_the_table == NULL, "One symbol table allowed.");
|
||||
_the_table = new SymbolTable();
|
||||
initialize_symbols(symbol_alloc_arena_size);
|
||||
}
|
||||
|
||||
static void create_table(HashtableBucket* t, int length,
|
||||
|
@ -134,6 +141,9 @@ public:
|
|||
assert(length == symbol_table_size * sizeof(HashtableBucket),
|
||||
"bad shared symbol size.");
|
||||
_the_table = new SymbolTable(t, number_of_entries);
|
||||
// if CDS give symbol table a default arena size since most symbols
|
||||
// are already allocated in the shared misc section.
|
||||
initialize_symbols();
|
||||
}
|
||||
|
||||
static Symbol* lookup(const char* name, int len, TRAPS);
|
||||
|
@ -151,7 +161,7 @@ public:
|
|||
static Symbol* lookup_unicode(const jchar* name, int len, TRAPS);
|
||||
static Symbol* lookup_only_unicode(const jchar* name, int len, unsigned int& hash);
|
||||
|
||||
static void add(constantPoolHandle cp, int names_count,
|
||||
static void add(Handle class_loader, constantPoolHandle cp, int names_count,
|
||||
const char** names, int* lengths, int* cp_indices,
|
||||
unsigned int* hashValues, TRAPS);
|
||||
|
||||
|
@ -174,6 +184,9 @@ public:
|
|||
return lookup(sym, begin, end, THREAD);
|
||||
}
|
||||
|
||||
// Create a symbol in the arena for symbols that are not deleted
|
||||
static Symbol* new_permanent_symbol(const char* name, TRAPS);
|
||||
|
||||
// Symbol lookup
|
||||
static Symbol* lookup(int index, const char* name, int len, TRAPS);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue