mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8145628: hotspot metadata classes shouldn't use HeapWordSize or heap related macros like align_object_size
Use align_metadata_size, align_metadata_offset and is_metadata_aligned for metadata rather than align_object_size, etc. Use wordSize rather than HeapWordSize for metadata. Use align_ptr_up rather than align_pointer_up (all the related functions are ptr). Reviewed-by: hseigel, jmasa, cjplummer
This commit is contained in:
parent
ec7fb4ee2b
commit
97e169ac77
36 changed files with 108 additions and 106 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -180,6 +180,9 @@ static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
|
||||||
|
|
||||||
typedef void (*_zero_Fn)(HeapWord* to, size_t count);
|
typedef void (*_zero_Fn)(HeapWord* to, size_t count);
|
||||||
|
|
||||||
|
// Only used for heap objects, so align_object_offset.
|
||||||
|
// All other platforms pd_fill_to_aligned_words simply calls pd_fill_to_words, don't
|
||||||
|
// know why this one is different.
|
||||||
static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
|
static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
|
||||||
assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
|
assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -696,7 +696,7 @@ public class ConstantPool extends Metadata implements ClassConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSize() {
|
public long getSize() {
|
||||||
return Oop.alignObjectSize(headerSize + getLength());
|
return alignSize(headerSize + getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -70,7 +70,7 @@ public class ConstantPoolCache extends Metadata {
|
||||||
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
|
public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
|
||||||
|
|
||||||
public long getSize() {
|
public long getSize() {
|
||||||
return Oop.alignObjectSize(baseOffset + getLength() * elementSize);
|
return alignSize(baseOffset + getLength() * elementSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstantPoolCacheEntry getEntryAt(int i) {
|
public ConstantPoolCacheEntry getEntryAt(int i) {
|
||||||
|
@ -79,8 +79,7 @@ public class ConstantPoolCache extends Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIntAt(int entry, int fld) {
|
public int getIntAt(int entry, int fld) {
|
||||||
//alignObjectSize ?
|
long offset = baseOffset + entry * elementSize + fld * intSize;
|
||||||
long offset = baseOffset + /*alignObjectSize*/entry * elementSize + fld * intSize;
|
|
||||||
return (int) getAddress().getCIntegerAt(offset, intSize, true );
|
return (int) getAddress().getCIntegerAt(offset, intSize, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,8 +242,7 @@ public class InstanceKlass extends Klass {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSize() {
|
public long getSize() {
|
||||||
return Oop.alignObjectSize(getHeaderSize() + getVtableLen() +
|
return alignSize(getHeaderSize() + getVtableLen() + getItableLen() + getNonstaticOopMapSize());
|
||||||
getItableLen() + getNonstaticOopMapSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getHeaderSize() { return headerSize; }
|
public static long getHeaderSize() { return headerSize; }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,6 +44,11 @@ abstract public class Metadata extends VMObject {
|
||||||
super(addr);
|
super(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static long alignSize(long size) {
|
||||||
|
// natural word size.
|
||||||
|
return VM.getVM().alignUp(size, VM.getVM().getBytesPerWord());
|
||||||
|
}
|
||||||
|
|
||||||
private static VirtualBaseConstructor<Metadata> metadataConstructor;
|
private static VirtualBaseConstructor<Metadata> metadataConstructor;
|
||||||
|
|
||||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -252,7 +252,7 @@ public class MethodData extends Metadata implements MethodDataInterface<Klass,Me
|
||||||
}
|
}
|
||||||
|
|
||||||
int size() {
|
int size() {
|
||||||
return (int)Oop.alignObjectSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
|
return (int)alignSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
|
||||||
}
|
}
|
||||||
|
|
||||||
ParametersTypeData<Klass,Method> parametersTypeData() {
|
ParametersTypeData<Klass,Method> parametersTypeData() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2705,7 +2705,7 @@ Method* ClassFileParser::parse_method(const ClassFileStream* const cfs,
|
||||||
ConstMethod::NORMAL,
|
ConstMethod::NORMAL,
|
||||||
CHECK_NULL);
|
CHECK_NULL);
|
||||||
|
|
||||||
ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
|
ClassLoadingService::add_class_method_size(m->size()*wordSize);
|
||||||
|
|
||||||
// Fill in information from fixed part (access_flags already set)
|
// Fill in information from fixed part (access_flags already set)
|
||||||
m->set_constants(_cp);
|
m->set_constants(_cp);
|
||||||
|
|
|
@ -737,7 +737,7 @@ bool StringTable::copy_compact_table(char** top, char *end, GrowableArray<MemReg
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ch_table.dump(top, end);
|
ch_table.dump(top, end);
|
||||||
*top = (char*)align_pointer_up(*top, sizeof(void*));
|
*top = (char*)align_ptr_up(*top, sizeof(void*));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
@ -760,7 +760,7 @@ const char* StringTable::init_shared_table(FileMapInfo *mapinfo, char *buffer) {
|
||||||
juint *p = (juint*)buffer;
|
juint *p = (juint*)buffer;
|
||||||
const char* end = _shared_table.init(
|
const char* end = _shared_table.init(
|
||||||
CompactHashtable<oop, char>::_string_table, (char*)p);
|
CompactHashtable<oop, char>::_string_table, (char*)p);
|
||||||
const char* aligned_end = (const char*)align_pointer_up(end, sizeof(void*));
|
const char* aligned_end = (const char*)align_ptr_up(end, sizeof(void*));
|
||||||
|
|
||||||
if (_ignore_shared_strings) {
|
if (_ignore_shared_strings) {
|
||||||
_shared_table.reset();
|
_shared_table.reset();
|
||||||
|
|
|
@ -544,7 +544,7 @@ bool SymbolTable::copy_compact_table(char** top, char*end) {
|
||||||
|
|
||||||
ch_table.dump(top, end);
|
ch_table.dump(top, end);
|
||||||
|
|
||||||
*top = (char*)align_pointer_up(*top, sizeof(void*));
|
*top = (char*)align_ptr_up(*top, sizeof(void*));
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ bool SymbolTable::copy_compact_table(char** top, char*end) {
|
||||||
const char* SymbolTable::init_shared_table(const char* buffer) {
|
const char* SymbolTable::init_shared_table(const char* buffer) {
|
||||||
const char* end = _shared_table.init(
|
const char* end = _shared_table.init(
|
||||||
CompactHashtable<Symbol*, char>::_symbol_table, buffer);
|
CompactHashtable<Symbol*, char>::_symbol_table, buffer);
|
||||||
return (const char*)align_pointer_up(end, sizeof(void*));
|
return (const char*)align_ptr_up(end, sizeof(void*));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -600,7 +600,7 @@ void SymbolTable::print_histogram() {
|
||||||
tty->print_cr("Symbol Table Histogram:");
|
tty->print_cr("Symbol Table Histogram:");
|
||||||
tty->print_cr(" Total number of symbols %7d", total_count);
|
tty->print_cr(" Total number of symbols %7d", total_count);
|
||||||
tty->print_cr(" Total size in memory %7dK",
|
tty->print_cr(" Total size in memory %7dK",
|
||||||
(total_size*HeapWordSize)/1024);
|
(total_size*wordSize)/1024);
|
||||||
tty->print_cr(" Total counted %7d", _symbols_counted);
|
tty->print_cr(" Total counted %7d", _symbols_counted);
|
||||||
tty->print_cr(" Total removed %7d", _symbols_removed);
|
tty->print_cr(" Total removed %7d", _symbols_removed);
|
||||||
if (_symbols_counted > 0) {
|
if (_symbols_counted > 0) {
|
||||||
|
@ -617,11 +617,11 @@ void SymbolTable::print_histogram() {
|
||||||
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
|
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
|
||||||
for (i = 0; i < results_length; i++) {
|
for (i = 0; i < results_length; i++) {
|
||||||
if (counts[i] > 0) {
|
if (counts[i] > 0) {
|
||||||
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*HeapWordSize)/1024);
|
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*wordSize)/1024);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tty->print_cr(" >=%6d %10d %10dK\n", results_length,
|
tty->print_cr(" >=%6d %10d %10dK\n", results_length,
|
||||||
out_of_range_count, (out_of_range_size*HeapWordSize)/1024);
|
out_of_range_count, (out_of_range_size*wordSize)/1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SymbolTable::print() {
|
void SymbolTable::print() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -438,7 +438,7 @@ void G1ArchiveAllocator::complete_archive(GrowableArray<MemRegion>* ranges,
|
||||||
// If an end alignment was requested, insert filler objects.
|
// If an end alignment was requested, insert filler objects.
|
||||||
if (end_alignment_in_bytes != 0) {
|
if (end_alignment_in_bytes != 0) {
|
||||||
HeapWord* currtop = _allocation_region->top();
|
HeapWord* currtop = _allocation_region->top();
|
||||||
HeapWord* newtop = (HeapWord*)align_pointer_up(currtop, end_alignment_in_bytes);
|
HeapWord* newtop = (HeapWord*)align_ptr_up(currtop, end_alignment_in_bytes);
|
||||||
size_t fill_size = pointer_delta(newtop, currtop);
|
size_t fill_size = pointer_delta(newtop, currtop);
|
||||||
if (fill_size != 0) {
|
if (fill_size != 0) {
|
||||||
if (fill_size < CollectedHeap::min_fill_size()) {
|
if (fill_size < CollectedHeap::min_fill_size()) {
|
||||||
|
@ -447,8 +447,8 @@ void G1ArchiveAllocator::complete_archive(GrowableArray<MemRegion>* ranges,
|
||||||
// region boundary because the max supported alignment is smaller than the min
|
// region boundary because the max supported alignment is smaller than the min
|
||||||
// region size, and because the allocation code never leaves space smaller than
|
// region size, and because the allocation code never leaves space smaller than
|
||||||
// the min_fill_size at the top of the current allocation region.
|
// the min_fill_size at the top of the current allocation region.
|
||||||
newtop = (HeapWord*)align_pointer_up(currtop + CollectedHeap::min_fill_size(),
|
newtop = (HeapWord*)align_ptr_up(currtop + CollectedHeap::min_fill_size(),
|
||||||
end_alignment_in_bytes);
|
end_alignment_in_bytes);
|
||||||
fill_size = pointer_delta(newtop, currtop);
|
fill_size = pointer_delta(newtop, currtop);
|
||||||
}
|
}
|
||||||
HeapWord* fill = archive_mem_allocate(fill_size);
|
HeapWord* fill = archive_mem_allocate(fill_size);
|
||||||
|
|
|
@ -249,7 +249,7 @@ inline HeapWord* CollectedHeap::align_allocation_or_fail(HeapWord* addr,
|
||||||
assert(is_size_aligned(alignment_in_bytes, HeapWordSize),
|
assert(is_size_aligned(alignment_in_bytes, HeapWordSize),
|
||||||
"Alignment size %u is incorrect.", alignment_in_bytes);
|
"Alignment size %u is incorrect.", alignment_in_bytes);
|
||||||
|
|
||||||
HeapWord* new_addr = (HeapWord*) align_pointer_up(addr, alignment_in_bytes);
|
HeapWord* new_addr = (HeapWord*) align_ptr_up(addr, alignment_in_bytes);
|
||||||
size_t padding = pointer_delta(new_addr, addr);
|
size_t padding = pointer_delta(new_addr, addr);
|
||||||
|
|
||||||
if (padding == 0) {
|
if (padding == 0) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -264,7 +264,7 @@ bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* s
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//climit = cache->length(); // %%% private!
|
//climit = cache->length(); // %%% private!
|
||||||
size_t size = cache->size() * HeapWordSize;
|
size_t size = cache->size() * wordSize;
|
||||||
size -= sizeof(ConstantPoolCache);
|
size -= sizeof(ConstantPoolCache);
|
||||||
size /= sizeof(ConstantPoolCacheEntry);
|
size /= sizeof(ConstantPoolCacheEntry);
|
||||||
climit = (int) size;
|
climit = (int) size;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -3474,7 +3474,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero initialize.
|
// Zero initialize.
|
||||||
Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0);
|
Copy::fill_to_words((HeapWord*)result, word_size, 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3513,7 +3513,7 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero initialize.
|
// Zero initialize.
|
||||||
Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0);
|
Copy::fill_to_words((HeapWord*)result, word_size, 0);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -3583,7 +3583,7 @@ const char* Metaspace::metadata_type_name(Metaspace::MetadataType mdtype) {
|
||||||
void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) {
|
void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) {
|
||||||
assert(DumpSharedSpaces, "sanity");
|
assert(DumpSharedSpaces, "sanity");
|
||||||
|
|
||||||
int byte_size = (int)word_size * HeapWordSize;
|
int byte_size = (int)word_size * wordSize;
|
||||||
AllocRecord *rec = new AllocRecord((address)ptr, type, byte_size);
|
AllocRecord *rec = new AllocRecord((address)ptr, type, byte_size);
|
||||||
|
|
||||||
if (_alloc_record_head == NULL) {
|
if (_alloc_record_head == NULL) {
|
||||||
|
@ -3623,7 +3623,7 @@ void Metaspace::record_deallocation(void* ptr, size_t word_size) {
|
||||||
|
|
||||||
for (AllocRecord *rec = _alloc_record_head; rec; rec = rec->_next) {
|
for (AllocRecord *rec = _alloc_record_head; rec; rec = rec->_next) {
|
||||||
if (rec->_ptr == ptr) {
|
if (rec->_ptr == ptr) {
|
||||||
assert(rec->_byte_size == (int)word_size * HeapWordSize, "sanity");
|
assert(rec->_byte_size == (int)word_size * wordSize, "sanity");
|
||||||
rec->_type = MetaspaceObj::DeallocatedType;
|
rec->_type = MetaspaceObj::DeallocatedType;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -41,7 +41,7 @@ PaddedEnd<T>* PaddedArray<T, flags, alignment>::create_unfreeable(uint length) {
|
||||||
void* chunk = AllocateHeap(length * sizeof(PaddedEnd<T, alignment>) + alignment, flags);
|
void* chunk = AllocateHeap(length * sizeof(PaddedEnd<T, alignment>) + alignment, flags);
|
||||||
|
|
||||||
// Make the initial alignment.
|
// Make the initial alignment.
|
||||||
PaddedEnd<T>* aligned_padded_array = (PaddedEnd<T>*)align_pointer_up(chunk, alignment);
|
PaddedEnd<T>* aligned_padded_array = (PaddedEnd<T>*)align_ptr_up(chunk, alignment);
|
||||||
|
|
||||||
// Call the default constructor for each element.
|
// Call the default constructor for each element.
|
||||||
for (uint i = 0; i < length; i++) {
|
for (uint i = 0; i < length; i++) {
|
||||||
|
@ -65,7 +65,7 @@ T** Padded2DArray<T, flags, alignment>::create_unfreeable(uint rows, uint column
|
||||||
// Clear the allocated memory.
|
// Clear the allocated memory.
|
||||||
memset(chunk, 0, total_size);
|
memset(chunk, 0, total_size);
|
||||||
// Align the chunk of memory.
|
// Align the chunk of memory.
|
||||||
T** result = (T**)align_pointer_up(chunk, alignment);
|
T** result = (T**)align_ptr_up(chunk, alignment);
|
||||||
void* data_start = (void*)((uintptr_t)result + table_size);
|
void* data_start = (void*)((uintptr_t)result + table_size);
|
||||||
|
|
||||||
// Fill in the row table.
|
// Fill in the row table.
|
||||||
|
@ -87,7 +87,7 @@ T* PaddedPrimitiveArray<T, flags, alignment>::create_unfreeable(size_t length) {
|
||||||
|
|
||||||
memset(chunk, 0, length * sizeof(T) + alignment);
|
memset(chunk, 0, length * sizeof(T) + alignment);
|
||||||
|
|
||||||
return (T*)align_pointer_up(chunk, alignment);
|
return (T*)align_ptr_up(chunk, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SHARE_VM_MEMORY_PADDED_INLINE_HPP
|
#endif // SHARE_VM_MEMORY_PADDED_INLINE_HPP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -502,7 +502,7 @@ void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t ali
|
||||||
|
|
||||||
// Calc address range within we try to attach (range of possible start addresses).
|
// Calc address range within we try to attach (range of possible start addresses).
|
||||||
char* const highest_start = (char *)align_ptr_down((char *)UnscaledOopHeapMax - size, attach_point_alignment);
|
char* const highest_start = (char *)align_ptr_down((char *)UnscaledOopHeapMax - size, attach_point_alignment);
|
||||||
char* const lowest_start = (char *)align_ptr_up ( aligned_heap_base_min_address , attach_point_alignment);
|
char* const lowest_start = (char *)align_ptr_up(aligned_heap_base_min_address, attach_point_alignment);
|
||||||
try_reserve_range(highest_start, lowest_start, attach_point_alignment,
|
try_reserve_range(highest_start, lowest_start, attach_point_alignment,
|
||||||
aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, large);
|
aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, large);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ int ArrayKlass::static_size(int header_size) {
|
||||||
header_size = InstanceKlass::header_size();
|
header_size = InstanceKlass::header_size();
|
||||||
int vtable_len = Universe::base_vtable_size();
|
int vtable_len = Universe::base_vtable_size();
|
||||||
int size = header_size + vtable_len;
|
int size = header_size + vtable_len;
|
||||||
return align_object_size(size);
|
return align_metadata_size(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -99,7 +99,7 @@ class ArrayKlass: public Klass {
|
||||||
bool compute_is_subtype_of(Klass* k);
|
bool compute_is_subtype_of(Klass* k);
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
static int header_size() { return sizeof(ArrayKlass)/HeapWordSize; }
|
static int header_size() { return sizeof(ArrayKlass)/wordSize; }
|
||||||
static int static_size(int header_size);
|
static int static_size(int header_size);
|
||||||
|
|
||||||
#if INCLUDE_SERVICES
|
#if INCLUDE_SERVICES
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -144,7 +144,7 @@ int ConstMethod::size(int code_size,
|
||||||
|
|
||||||
int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
|
int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
|
||||||
assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
|
assert(extra_words == extra_bytes/BytesPerWord, "should already be aligned");
|
||||||
return align_object_size(header_size() + extra_words);
|
return align_metadata_size(header_size() + extra_words);
|
||||||
}
|
}
|
||||||
|
|
||||||
Method* ConstMethod::method() const {
|
Method* ConstMethod::method() const {
|
||||||
|
@ -492,6 +492,6 @@ void ConstMethod::verify_on(outputStream* st) {
|
||||||
uncompressed_table_start = (u2*) m_end;
|
uncompressed_table_start = (u2*) m_end;
|
||||||
}
|
}
|
||||||
int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
|
int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end;
|
||||||
int max_gap = align_object_size(1)*BytesPerWord;
|
int max_gap = align_metadata_size(1)*BytesPerWord;
|
||||||
guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
|
guarantee(gap >= 0 && gap < max_gap, "invalid method layout");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -328,9 +328,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
static int header_size() {
|
static int header_size() { return sizeof(ConstMethod)/wordSize; }
|
||||||
return sizeof(ConstMethod)/HeapWordSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size needed
|
// Size needed
|
||||||
static int size(int code_size, InlineTableSizes* sizes);
|
static int size(int code_size, InlineTableSizes* sizes);
|
||||||
|
|
|
@ -723,8 +723,8 @@ class ConstantPool : public Metadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sizing (in words)
|
// Sizing (in words)
|
||||||
static int header_size() { return sizeof(ConstantPool)/HeapWordSize; }
|
static int header_size() { return sizeof(ConstantPool)/wordSize; }
|
||||||
static int size(int length) { return align_object_size(header_size() + length); }
|
static int size(int length) { return align_metadata_size(header_size() + length); }
|
||||||
int size() const { return size(length()); }
|
int size() const { return size(length()); }
|
||||||
#if INCLUDE_SERVICES
|
#if INCLUDE_SERVICES
|
||||||
void collect_statistics(KlassSizeStats *sz) const;
|
void collect_statistics(KlassSizeStats *sz) const;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -364,7 +364,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
|
||||||
return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
|
return (TosState)((_flags >> tos_state_shift) & tos_state_mask); }
|
||||||
|
|
||||||
// Code generation support
|
// Code generation support
|
||||||
static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
|
static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / wordSize); }
|
||||||
static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
|
static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
|
||||||
static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
|
static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
|
||||||
static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
|
static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
|
||||||
|
@ -439,14 +439,14 @@ class ConstantPoolCache: public MetaspaceObj {
|
||||||
private:
|
private:
|
||||||
void set_length(int length) { _length = length; }
|
void set_length(int length) { _length = length; }
|
||||||
|
|
||||||
static int header_size() { return sizeof(ConstantPoolCache) / HeapWordSize; }
|
static int header_size() { return sizeof(ConstantPoolCache) / wordSize; }
|
||||||
static int size(int length) { return align_object_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }
|
static int size(int length) { return align_metadata_size(header_size() + length * in_words(ConstantPoolCacheEntry::size())); }
|
||||||
public:
|
public:
|
||||||
int size() const { return size(length()); }
|
int size() const { return size(length()); }
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
ConstantPool** constant_pool_addr() { return &_constant_pool; }
|
ConstantPool** constant_pool_addr() { return &_constant_pool; }
|
||||||
ConstantPoolCacheEntry* base() const { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
|
ConstantPoolCacheEntry* base() const { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
|
||||||
|
|
||||||
friend class constantPoolCacheKlass;
|
friend class constantPoolCacheKlass;
|
||||||
|
|
|
@ -2909,10 +2909,10 @@ const char* InstanceKlass::internal_name() const {
|
||||||
void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
|
void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
|
||||||
Klass::collect_statistics(sz);
|
Klass::collect_statistics(sz);
|
||||||
|
|
||||||
sz->_inst_size = HeapWordSize * size_helper();
|
sz->_inst_size = wordSize * size_helper();
|
||||||
sz->_vtab_bytes = HeapWordSize * vtable_length();
|
sz->_vtab_bytes = wordSize * vtable_length();
|
||||||
sz->_itab_bytes = HeapWordSize * itable_length();
|
sz->_itab_bytes = wordSize * itable_length();
|
||||||
sz->_nonstatic_oopmap_bytes = HeapWordSize * nonstatic_oop_map_size();
|
sz->_nonstatic_oopmap_bytes = wordSize * nonstatic_oop_map_size();
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
n += (sz->_methods_array_bytes = sz->count_array(methods()));
|
n += (sz->_methods_array_bytes = sz->count_array(methods()));
|
||||||
|
|
|
@ -94,10 +94,10 @@ class OopMapBlock VALUE_OBJ_CLASS_SPEC {
|
||||||
uint count() const { return _count; }
|
uint count() const { return _count; }
|
||||||
void set_count(uint count) { _count = count; }
|
void set_count(uint count) { _count = count; }
|
||||||
|
|
||||||
// sizeof(OopMapBlock) in HeapWords.
|
// sizeof(OopMapBlock) in words.
|
||||||
static const int size_in_words() {
|
static const int size_in_words() {
|
||||||
return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
|
return align_size_up(int(sizeof(OopMapBlock)), wordSize) >>
|
||||||
LogHeapWordSize;
|
LogBytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -927,17 +927,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sizing (in words)
|
// Sizing (in words)
|
||||||
static int header_size() { return sizeof(InstanceKlass)/HeapWordSize; }
|
static int header_size() { return sizeof(InstanceKlass)/wordSize; }
|
||||||
|
|
||||||
static int size(int vtable_length, int itable_length,
|
static int size(int vtable_length, int itable_length,
|
||||||
int nonstatic_oop_map_size,
|
int nonstatic_oop_map_size,
|
||||||
bool is_interface, bool is_anonymous) {
|
bool is_interface, bool is_anonymous) {
|
||||||
return align_object_size(header_size() +
|
return align_metadata_size(header_size() +
|
||||||
vtable_length +
|
vtable_length +
|
||||||
itable_length +
|
itable_length +
|
||||||
nonstatic_oop_map_size +
|
nonstatic_oop_map_size +
|
||||||
(is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
|
(is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
|
||||||
(is_anonymous ? (int)sizeof(Klass*)/HeapWordSize : 0));
|
(is_anonymous ? (int)sizeof(Klass*)/wordSize : 0));
|
||||||
}
|
}
|
||||||
int size() const { return size(vtable_length(),
|
int size() const { return size(vtable_length(),
|
||||||
itable_length(),
|
itable_length(),
|
||||||
|
|
|
@ -352,13 +352,13 @@ protected:
|
||||||
| (log2_esize << _lh_log2_element_size_shift);
|
| (log2_esize << _lh_log2_element_size_shift);
|
||||||
}
|
}
|
||||||
static jint instance_layout_helper(jint size, bool slow_path_flag) {
|
static jint instance_layout_helper(jint size, bool slow_path_flag) {
|
||||||
return (size << LogHeapWordSize)
|
return (size << LogBytesPerWord)
|
||||||
| (slow_path_flag ? _lh_instance_slow_path_bit : 0);
|
| (slow_path_flag ? _lh_instance_slow_path_bit : 0);
|
||||||
}
|
}
|
||||||
static int layout_helper_to_size_helper(jint lh) {
|
static int layout_helper_to_size_helper(jint lh) {
|
||||||
assert(lh > (jint)_lh_neutral_value, "must be instance");
|
assert(lh > (jint)_lh_neutral_value, "must be instance");
|
||||||
// Note that the following expression discards _lh_instance_slow_path_bit.
|
// Note that the following expression discards _lh_instance_slow_path_bit.
|
||||||
return lh >> LogHeapWordSize;
|
return lh >> LogBytesPerWord;
|
||||||
}
|
}
|
||||||
// Out-of-line version computes everything based on the etype:
|
// Out-of-line version computes everything based on the etype:
|
||||||
static jint array_layout_helper(BasicType etype);
|
static jint array_layout_helper(BasicType etype);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -1331,7 +1331,7 @@ int klassItable::compute_itable_size(Array<Klass*>* transitive_interfaces) {
|
||||||
int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
|
int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
update_stats(itable_size * HeapWordSize);
|
update_stats(itable_size * wordSize);
|
||||||
|
|
||||||
return itable_size;
|
return itable_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,12 +170,9 @@ class vtableEntry VALUE_OBJ_CLASS_SPEC {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// size in words
|
// size in words
|
||||||
static int size() {
|
static int size() { return sizeof(vtableEntry) / wordSize; }
|
||||||
return sizeof(vtableEntry) / sizeof(HeapWord);
|
static int size_in_bytes() { return sizeof(vtableEntry); }
|
||||||
}
|
|
||||||
static int size_in_bytes() {
|
|
||||||
return sizeof(vtableEntry);
|
|
||||||
}
|
|
||||||
static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); }
|
static int method_offset_in_bytes() { return offset_of(vtableEntry, _method); }
|
||||||
Method* method() const { return _method; }
|
Method* method() const { return _method; }
|
||||||
|
|
||||||
|
@ -226,7 +223,7 @@ class itableOffsetEntry VALUE_OBJ_CLASS_SPEC {
|
||||||
void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; }
|
void initialize(Klass* interf, int offset) { _interface = interf; _offset = offset; }
|
||||||
|
|
||||||
// Static size and offset accessors
|
// Static size and offset accessors
|
||||||
static int size() { return sizeof(itableOffsetEntry) / HeapWordSize; } // size in words
|
static int size() { return sizeof(itableOffsetEntry) / wordSize; } // size in words
|
||||||
static int interface_offset_in_bytes() { return offset_of(itableOffsetEntry, _interface); }
|
static int interface_offset_in_bytes() { return offset_of(itableOffsetEntry, _interface); }
|
||||||
static int offset_offset_in_bytes() { return offset_of(itableOffsetEntry, _offset); }
|
static int offset_offset_in_bytes() { return offset_of(itableOffsetEntry, _offset); }
|
||||||
|
|
||||||
|
@ -246,7 +243,7 @@ class itableMethodEntry VALUE_OBJ_CLASS_SPEC {
|
||||||
void initialize(Method* method);
|
void initialize(Method* method);
|
||||||
|
|
||||||
// Static size and offset accessors
|
// Static size and offset accessors
|
||||||
static int size() { return sizeof(itableMethodEntry) / HeapWordSize; } // size in words
|
static int size() { return sizeof(itableMethodEntry) / wordSize; } // size in words
|
||||||
static int method_offset_in_bytes() { return offset_of(itableMethodEntry, _method); }
|
static int method_offset_in_bytes() { return offset_of(itableMethodEntry, _method); }
|
||||||
|
|
||||||
friend class klassItable;
|
friend class klassItable;
|
||||||
|
|
|
@ -295,7 +295,7 @@ int Method::size(bool is_native) {
|
||||||
// If native, then include pointers for native_function and signature_handler
|
// If native, then include pointers for native_function and signature_handler
|
||||||
int extra_bytes = (is_native) ? 2*sizeof(address*) : 0;
|
int extra_bytes = (is_native) ? 2*sizeof(address*) : 0;
|
||||||
int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
|
int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
|
||||||
return align_object_size(header_size() + extra_words);
|
return align_metadata_size(header_size() + extra_words);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -622,7 +622,7 @@ class Method : public Metadata {
|
||||||
bool has_compiled_code() const { return code() != NULL; }
|
bool has_compiled_code() const { return code() != NULL; }
|
||||||
|
|
||||||
// sizing
|
// sizing
|
||||||
static int header_size() { return sizeof(Method)/HeapWordSize; }
|
static int header_size() { return sizeof(Method)/wordSize; }
|
||||||
static int size(bool is_native);
|
static int size(bool is_native);
|
||||||
int size() const { return method_size(); }
|
int size() const { return method_size(); }
|
||||||
#if INCLUDE_SERVICES
|
#if INCLUDE_SERVICES
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -934,7 +934,7 @@ int MethodData::compute_allocation_size_in_bytes(const methodHandle& method) {
|
||||||
int MethodData::compute_allocation_size_in_words(const methodHandle& method) {
|
int MethodData::compute_allocation_size_in_words(const methodHandle& method) {
|
||||||
int byte_size = compute_allocation_size_in_bytes(method);
|
int byte_size = compute_allocation_size_in_bytes(method);
|
||||||
int word_size = align_size_up(byte_size, BytesPerWord) / BytesPerWord;
|
int word_size = align_size_up(byte_size, BytesPerWord) / BytesPerWord;
|
||||||
return align_object_size(word_size);
|
return align_metadata_size(word_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize an individual data segment. Returns the size of
|
// Initialize an individual data segment. Returns the size of
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -2334,7 +2334,7 @@ public:
|
||||||
|
|
||||||
// My size
|
// My size
|
||||||
int size_in_bytes() const { return _size; }
|
int size_in_bytes() const { return _size; }
|
||||||
int size() const { return align_object_size(align_size_up(_size, BytesPerWord)/BytesPerWord); }
|
int size() const { return align_metadata_size(align_size_up(_size, BytesPerWord)/BytesPerWord); }
|
||||||
#if INCLUDE_SERVICES
|
#if INCLUDE_SERVICES
|
||||||
void collect_statistics(KlassSizeStats *sz) const;
|
void collect_statistics(KlassSizeStats *sz) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -101,7 +101,7 @@ class ObjArrayKlass : public ArrayKlass {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
static int header_size() { return sizeof(ObjArrayKlass)/HeapWordSize; }
|
static int header_size() { return sizeof(ObjArrayKlass)/wordSize; }
|
||||||
int size() const { return ArrayKlass::static_size(header_size()); }
|
int size() const { return ArrayKlass::static_size(header_size()); }
|
||||||
|
|
||||||
// Initialization (virtual from Klass)
|
// Initialization (virtual from Klass)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,20 +42,19 @@ Symbol::Symbol(const u1* name, int length, int refcount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Symbol::operator new(size_t sz, int len, TRAPS) throw() {
|
void* Symbol::operator new(size_t sz, int len, TRAPS) throw() {
|
||||||
int alloc_size = size(len)*HeapWordSize;
|
int alloc_size = size(len)*wordSize;
|
||||||
address res = (address) AllocateHeap(alloc_size, mtSymbol);
|
address res = (address) AllocateHeap(alloc_size, mtSymbol);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) throw() {
|
void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) throw() {
|
||||||
int alloc_size = size(len)*HeapWordSize;
|
int alloc_size = size(len)*wordSize;
|
||||||
address res = (address)arena->Amalloc(alloc_size);
|
address res = (address)arena->Amalloc_4(alloc_size);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Symbol::operator new(size_t sz, int len, ClassLoaderData* loader_data, TRAPS) throw() {
|
void* Symbol::operator new(size_t sz, int len, ClassLoaderData* loader_data, TRAPS) throw() {
|
||||||
address res;
|
address res;
|
||||||
int alloc_size = size(len)*HeapWordSize;
|
|
||||||
res = (address) Metaspace::allocate(loader_data, size(len), true,
|
res = (address) Metaspace::allocate(loader_data, size(len), true,
|
||||||
MetaspaceObj::SymbolType, CHECK_NULL);
|
MetaspaceObj::SymbolType, CHECK_NULL);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -125,8 +125,8 @@ class Symbol : public MetaspaceObj {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int size(int length) {
|
static int size(int length) {
|
||||||
size_t sz = heap_word_size(sizeof(Symbol) + (length > 2 ? length - 2 : 0));
|
// minimum number of natural words needed to hold these bits (no non-heap version)
|
||||||
return align_object_size(sz);
|
return (int)heap_word_size(sizeof(Symbol) + (length > 2 ? length - 2 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void byte_at_put(int index, int value) {
|
void byte_at_put(int index, int value) {
|
||||||
|
|
|
@ -133,7 +133,7 @@ class TypeArrayKlass : public ArrayKlass {
|
||||||
static const char* external_name(BasicType type);
|
static const char* external_name(BasicType type);
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
static int header_size() { return sizeof(TypeArrayKlass)/HeapWordSize; }
|
static int header_size() { return sizeof(TypeArrayKlass)/wordSize; }
|
||||||
int size() const { return ArrayKlass::static_size(header_size()); }
|
int size() const { return ArrayKlass::static_size(header_size()); }
|
||||||
|
|
||||||
// Initialization (virtual from Klass)
|
// Initialization (virtual from Klass)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -85,6 +85,8 @@ void basic_types_init() {
|
||||||
assert( 1 == sizeof( u1), "wrong size for basic type");
|
assert( 1 == sizeof( u1), "wrong size for basic type");
|
||||||
assert( 2 == sizeof( u2), "wrong size for basic type");
|
assert( 2 == sizeof( u2), "wrong size for basic type");
|
||||||
assert( 4 == sizeof( u4), "wrong size for basic type");
|
assert( 4 == sizeof( u4), "wrong size for basic type");
|
||||||
|
assert(wordSize == BytesPerWord, "should be the same since they're used interchangeably");
|
||||||
|
assert(wordSize == HeapWordSize, "should be the same since they're also used interchangeably");
|
||||||
|
|
||||||
int num_type_chars = 0;
|
int num_type_chars = 0;
|
||||||
for (int i = 0; i < 99; i++) {
|
for (int i = 0; i < 99; i++) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -157,7 +157,6 @@ class HeapWord {
|
||||||
// Analogous opaque struct for metadata allocated from
|
// Analogous opaque struct for metadata allocated from
|
||||||
// metaspaces.
|
// metaspaces.
|
||||||
class MetaWord {
|
class MetaWord {
|
||||||
friend class VMStructs;
|
|
||||||
private:
|
private:
|
||||||
char* i;
|
char* i;
|
||||||
};
|
};
|
||||||
|
@ -486,7 +485,7 @@ inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
|
||||||
|
|
||||||
#define is_size_aligned_(size, alignment) ((size) == (align_size_up_(size, alignment)))
|
#define is_size_aligned_(size, alignment) ((size) == (align_size_up_(size, alignment)))
|
||||||
|
|
||||||
inline void* align_ptr_up(void* ptr, size_t alignment) {
|
inline void* align_ptr_up(const void* ptr, size_t alignment) {
|
||||||
return (void*)align_size_up((intptr_t)ptr, (intptr_t)alignment);
|
return (void*)align_size_up((intptr_t)ptr, (intptr_t)alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,10 +493,15 @@ inline void* align_ptr_down(void* ptr, size_t alignment) {
|
||||||
return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
|
return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Align objects by rounding up their size, in HeapWord units.
|
// Align metaspace objects by rounding up to natural word boundary
|
||||||
|
|
||||||
#define align_object_size_(size) align_size_up_(size, MinObjAlignment)
|
inline intptr_t align_metadata_size(intptr_t size) {
|
||||||
|
return align_size_up(size, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Align objects in the Java Heap by rounding up their size, in HeapWord units.
|
||||||
|
// Since the size is given in words this is somewhat of a nop, but
|
||||||
|
// distinguishes it from align_object_size.
|
||||||
inline intptr_t align_object_size(intptr_t size) {
|
inline intptr_t align_object_size(intptr_t size) {
|
||||||
return align_size_up(size, MinObjAlignment);
|
return align_size_up(size, MinObjAlignment);
|
||||||
}
|
}
|
||||||
|
@ -512,10 +516,6 @@ inline intptr_t align_object_offset(intptr_t offset) {
|
||||||
return align_size_up(offset, HeapWordsPerLong);
|
return align_size_up(offset, HeapWordsPerLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void* align_pointer_up(const void* addr, size_t size) {
|
|
||||||
return (void*) align_size_up_((uintptr_t)addr, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Align down with a lower bound. If the aligning results in 0, return 'alignment'.
|
// Align down with a lower bound. If the aligning results in 0, return 'alignment'.
|
||||||
|
|
||||||
inline size_t align_size_down_bounded(size_t size, size_t alignment) {
|
inline size_t align_size_down_bounded(size_t size, size_t alignment) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue