equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2016, 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. |
3472 if (PrintSharedSpaces) { |
3472 if (PrintSharedSpaces) { |
3473 space->record_allocation(result, type, space->vsm()->get_raw_word_size(word_size)); |
3473 space->record_allocation(result, type, space->vsm()->get_raw_word_size(word_size)); |
3474 } |
3474 } |
3475 |
3475 |
3476 // Zero initialize. |
3476 // Zero initialize. |
3477 Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0); |
3477 Copy::fill_to_words((HeapWord*)result, word_size, 0); |
3478 |
3478 |
3479 return result; |
3479 return result; |
3480 } |
3480 } |
3481 |
3481 |
3482 MetadataType mdtype = (type == MetaspaceObj::ClassType) ? ClassType : NonClassType; |
3482 MetadataType mdtype = (type == MetaspaceObj::ClassType) ? ClassType : NonClassType; |
3511 report_metadata_oome(loader_data, word_size, type, mdtype, CHECK_NULL); |
3511 report_metadata_oome(loader_data, word_size, type, mdtype, CHECK_NULL); |
3512 } |
3512 } |
3513 } |
3513 } |
3514 |
3514 |
3515 // Zero initialize. |
3515 // Zero initialize. |
3516 Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0); |
3516 Copy::fill_to_words((HeapWord*)result, word_size, 0); |
3517 |
3517 |
3518 return result; |
3518 return result; |
3519 } |
3519 } |
3520 |
3520 |
3521 size_t Metaspace::class_chunk_size(size_t word_size) { |
3521 size_t Metaspace::class_chunk_size(size_t word_size) { |
3581 } |
3581 } |
3582 |
3582 |
3583 void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) { |
3583 void Metaspace::record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size) { |
3584 assert(DumpSharedSpaces, "sanity"); |
3584 assert(DumpSharedSpaces, "sanity"); |
3585 |
3585 |
3586 int byte_size = (int)word_size * HeapWordSize; |
3586 int byte_size = (int)word_size * wordSize; |
3587 AllocRecord *rec = new AllocRecord((address)ptr, type, byte_size); |
3587 AllocRecord *rec = new AllocRecord((address)ptr, type, byte_size); |
3588 |
3588 |
3589 if (_alloc_record_head == NULL) { |
3589 if (_alloc_record_head == NULL) { |
3590 _alloc_record_head = _alloc_record_tail = rec; |
3590 _alloc_record_head = _alloc_record_tail = rec; |
3591 } else if (_alloc_record_tail->_ptr + _alloc_record_tail->_byte_size == (address)ptr) { |
3591 } else if (_alloc_record_tail->_ptr + _alloc_record_tail->_byte_size == (address)ptr) { |
3621 void Metaspace::record_deallocation(void* ptr, size_t word_size) { |
3621 void Metaspace::record_deallocation(void* ptr, size_t word_size) { |
3622 assert(DumpSharedSpaces, "sanity"); |
3622 assert(DumpSharedSpaces, "sanity"); |
3623 |
3623 |
3624 for (AllocRecord *rec = _alloc_record_head; rec; rec = rec->_next) { |
3624 for (AllocRecord *rec = _alloc_record_head; rec; rec = rec->_next) { |
3625 if (rec->_ptr == ptr) { |
3625 if (rec->_ptr == ptr) { |
3626 assert(rec->_byte_size == (int)word_size * HeapWordSize, "sanity"); |
3626 assert(rec->_byte_size == (int)word_size * wordSize, "sanity"); |
3627 rec->_type = MetaspaceObj::DeallocatedType; |
3627 rec->_type = MetaspaceObj::DeallocatedType; |
3628 return; |
3628 return; |
3629 } |
3629 } |
3630 } |
3630 } |
3631 |
3631 |