< prev index next >

src/share/vm/gc/g1/g1CodeCacheRemSet.cpp

Print this page
rev 9830 : [mq]: rev.01

*** 1,7 **** /* ! * Copyright (c) 2014, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2014, 2016, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 72,85 **** --- 72,91 ---- static void purge(); static size_t static_mem_size() { return sizeof(_purge_list); } + + size_t mem_size(); }; CodeRootSetTable* volatile CodeRootSetTable::_purge_list = NULL; + size_t CodeRootSetTable::mem_size() { + return sizeof(CodeRootSetTable) + (entry_size() * number_of_entries()) + (sizeof(HashtableBucket<mtGC>) * table_size()); + } + CodeRootSetTable::Entry* CodeRootSetTable::new_entry(nmethod* nm) { unsigned int hash = compute_hash(nm); Entry* entry = (Entry*) new_entry_free_list(); if (entry == NULL) { entry = (Entry*) NEW_C_HEAP_ARRAY2(char, entry_size(), mtGC, CURRENT_PC);
*** 230,240 **** CodeRootSetTable::purge_list_append(_table); OrderAccess::release_store_ptr(&_table, temp); } - void G1CodeRootSet::purge() { CodeRootSetTable::purge(); } size_t G1CodeRootSet::static_mem_size() { --- 236,245 ----
*** 245,260 **** bool added = false; if (is_empty()) { allocate_small_table(); } added = _table->add(method); if (_length == Threshold) { move_to_large(); } - if (added) { ++_length; } } bool G1CodeRootSet::remove(nmethod* method) { bool removed = false; if (_table != NULL) { --- 250,266 ---- bool added = false; if (is_empty()) { allocate_small_table(); } added = _table->add(method); + if (added) { if (_length == Threshold) { move_to_large(); } ++_length; } + assert(_length == (size_t)_table->number_of_entries(), "sizes should match"); } bool G1CodeRootSet::remove(nmethod* method) { bool removed = false; if (_table != NULL) {
*** 264,278 **** _length--; if (_length == 0) { clear(); } } return removed; } bool G1CodeRootSet::contains(nmethod* method) { ! CodeRootSetTable* table = load_acquire_table(); if (table != NULL) { return table->contains(method); } return false; } --- 270,286 ---- _length--; if (_length == 0) { clear(); } } + assert((_length == 0 && _table == NULL) || + (_length == (size_t)_table->number_of_entries()), "sizes should match"); return removed; } bool G1CodeRootSet::contains(nmethod* method) { ! CodeRootSetTable* table = load_acquire_table(); // contains() may be called outside of lock, so ensure mem sync. if (table != NULL) { return table->contains(method); } return false; }
*** 282,293 **** _table = NULL; _length = 0; } size_t G1CodeRootSet::mem_size() { ! return sizeof(*this) + ! (_table != NULL ? sizeof(CodeRootSetTable) + _table->entry_size() * _length : 0); } void G1CodeRootSet::nmethods_do(CodeBlobClosure* blk) const { if (_table != NULL) { _table->nmethods_do(blk); --- 290,300 ---- _table = NULL; _length = 0; } size_t G1CodeRootSet::mem_size() { ! return sizeof(*this) + (_table != NULL ? _table->mem_size() : 0); } void G1CodeRootSet::nmethods_do(CodeBlobClosure* blk) const { if (_table != NULL) { _table->nmethods_do(blk);
< prev index next >