mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com> Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com> Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com> Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
This commit is contained in:
parent
36eee7c8c8
commit
5c58d27aac
853 changed files with 26124 additions and 82956 deletions
|
@ -24,10 +24,12 @@
|
|||
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "classfile/altHashing.hpp"
|
||||
#include "classfile/classLoaderData.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
|
||||
Symbol::Symbol(const u1* name, int length, int refcount) : _refcount(refcount), _length(length) {
|
||||
_identity_hash = os::random();
|
||||
|
@ -37,19 +39,30 @@ Symbol::Symbol(const u1* name, int length, int refcount) : _refcount(refcount),
|
|||
}
|
||||
|
||||
void* Symbol::operator new(size_t sz, int len, TRAPS) {
|
||||
int alloc_size = object_size(len)*HeapWordSize;
|
||||
int alloc_size = size(len)*HeapWordSize;
|
||||
address res = (address) AllocateHeap(alloc_size, mtSymbol);
|
||||
DEBUG_ONLY(set_allocation_type(res, ResourceObj::C_HEAP);)
|
||||
return res;
|
||||
}
|
||||
|
||||
void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) {
|
||||
int alloc_size = object_size(len)*HeapWordSize;
|
||||
int alloc_size = size(len)*HeapWordSize;
|
||||
address res = (address)arena->Amalloc(alloc_size);
|
||||
DEBUG_ONLY(set_allocation_type(res, ResourceObj::ARENA);)
|
||||
return res;
|
||||
}
|
||||
|
||||
void* Symbol::operator new(size_t sz, int len, ClassLoaderData* loader_data, TRAPS) {
|
||||
address res;
|
||||
int alloc_size = size(len)*HeapWordSize;
|
||||
res = (address) Metaspace::allocate(loader_data, size(len), true,
|
||||
Metaspace::NonClassType, CHECK_NULL);
|
||||
return res;
|
||||
}
|
||||
|
||||
void Symbol::operator delete(void *p) {
|
||||
assert(((Symbol*)p)->refcount() == 0, "should not call this");
|
||||
FreeHeap(p);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Symbol::equals
|
||||
//
|
||||
|
@ -191,6 +204,12 @@ const char* Symbol::as_klass_external_name() const {
|
|||
return str;
|
||||
}
|
||||
|
||||
// Alternate hashing for unbalanced symbol tables.
|
||||
unsigned int Symbol::new_hash(jint seed) {
|
||||
ResourceMark rm;
|
||||
// Use alternate hashing algorithm on this symbol.
|
||||
return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length());
|
||||
}
|
||||
|
||||
void Symbol::print_on(outputStream* st) const {
|
||||
if (this == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue