< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahStrDedupTable.cpp

Print this page
rev 10658 : [backport] Single marking bitmap
rev 10715 : [backport] Cleanup up superfluous newlines
rev 10734 : Fix non-PCH builds
rev 10772 : [backport] Update copyrights

*** 1,7 **** /* ! * Copyright (c) 2017, 2018, Red Hat, Inc. and/or its affiliates. * * 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) 2017, 2018, Red Hat, Inc. All rights reserved. * * 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. *
*** 30,50 **** #include "gc_implementation/shenandoah/shenandoahLogging.hpp" #include "gc_implementation/shenandoah/shenandoahStrDedupTable.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" #include "runtime/safepoint.hpp" ! const size_t ShenandoahStrDedupTable::_min_size = (1 << 10); // 1024 const size_t ShenandoahStrDedupTable::_max_size = (1 << 24); // 16777216 const double ShenandoahStrDedupTable::_grow_load_factor = 2.0; // Grow table at 200% load const double ShenandoahStrDedupTable::_shrink_load_factor = _grow_load_factor / 3.0; // Shrink table at 67% load const double ShenandoahStrDedupTable::_max_cache_factor = 0.1; // Cache a maximum of 10% of the table size const uintx ShenandoahStrDedupTable::_rehash_multiple = 60; // Hash bucket has 60 times more collisions than expected const uintx ShenandoahStrDedupTable::_rehash_threshold = (uintx)(_rehash_multiple * _grow_load_factor); - bool ShenandoahStrDedupEntry::cas_set_next(ShenandoahStrDedupEntry* next) { return Atomic::cmpxchg_ptr(next, &_next, (ShenandoahStrDedupEntry*)NULL) == NULL; } ShenandoahStrDedupTable::ShenandoahStrDedupTable(size_t size, jint hash_seed) : --- 30,49 ---- #include "gc_implementation/shenandoah/shenandoahLogging.hpp" #include "gc_implementation/shenandoah/shenandoahStrDedupTable.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" #include "runtime/safepoint.hpp" ! #include "runtime/vmThread.hpp" const size_t ShenandoahStrDedupTable::_min_size = (1 << 10); // 1024 const size_t ShenandoahStrDedupTable::_max_size = (1 << 24); // 16777216 const double ShenandoahStrDedupTable::_grow_load_factor = 2.0; // Grow table at 200% load const double ShenandoahStrDedupTable::_shrink_load_factor = _grow_load_factor / 3.0; // Shrink table at 67% load const double ShenandoahStrDedupTable::_max_cache_factor = 0.1; // Cache a maximum of 10% of the table size const uintx ShenandoahStrDedupTable::_rehash_multiple = 60; // Hash bucket has 60 times more collisions than expected const uintx ShenandoahStrDedupTable::_rehash_threshold = (uintx)(_rehash_multiple * _grow_load_factor); bool ShenandoahStrDedupEntry::cas_set_next(ShenandoahStrDedupEntry* next) { return Atomic::cmpxchg_ptr(next, &_next, (ShenandoahStrDedupEntry*)NULL) == NULL; } ShenandoahStrDedupTable::ShenandoahStrDedupTable(size_t size, jint hash_seed) :
*** 163,173 **** // Existing value found, deduplicate string java_lang_String::set_value(java_string, typeArrayOop(existing_value)); return true; } - void ShenandoahStrDedupTable::clear_claimed() { _claimed = 0; _partition_size = size() / (ShenandoahHeap::heap()->max_workers() * 4); _partition_size = MAX2(_partition_size, size_t(1)); } --- 162,171 ----
*** 259,269 **** size_t num_entries = 0; for (size_t index = 0; index < size(); index ++) { ShenandoahStrDedupEntry* volatile head = bucket(index); while (head != NULL) { ! assert(heap->next_marking_context()->is_marked(head->obj()), "Must be marked"); if (use_java_hash()) { assert(head->hash() == java_hash_code(head->obj()), "Wrong hash code"); } else { assert(head->hash() == alt_hash_code(head->obj()), "Wrong alt hash code"); --- 257,267 ---- size_t num_entries = 0; for (size_t index = 0; index < size(); index ++) { ShenandoahStrDedupEntry* volatile head = bucket(index); while (head != NULL) { ! assert(heap->marking_context()->is_marked(head->obj()), "Must be marked"); if (use_java_hash()) { assert(head->hash() == java_hash_code(head->obj()), "Wrong hash code"); } else { assert(head->hash() == alt_hash_code(head->obj()), "Wrong alt hash code");
*** 278,288 **** } #endif ShenandoahStrDedupTableCleanupTask::ShenandoahStrDedupTableCleanupTask() : ! _mark_context(ShenandoahHeap::heap()->next_marking_context()) { } bool ShenandoahStrDedupTableCleanupTask::is_alive(oop obj) const { return _mark_context->is_marked(obj); } --- 276,286 ---- } #endif ShenandoahStrDedupTableCleanupTask::ShenandoahStrDedupTableCleanupTask() : ! _mark_context(ShenandoahHeap::heap()->marking_context()) { } bool ShenandoahStrDedupTableCleanupTask::is_alive(oop obj) const { return _mark_context->is_marked(obj); }
*** 366,376 **** } while (index < table_end); Atomic::add((jlong)added, (volatile jlong*)&dest_table()->_entries); } - ShenandoahStrDedupShrinkTableTask::ShenandoahStrDedupShrinkTableTask( ShenandoahStrDedupTable* const src, ShenandoahStrDedupTable* const dest) : ShenandoahStrDedupTableRemapTask(src, dest) { assert(is_power_of_2(src->size()), "Source table size must be a power of 2"); assert(is_power_of_2(dest->size()), "Destination table size must be a power of 2"); --- 364,373 ----
*** 409,419 **** } while (index < table_end); Atomic::add((jlong)transferred, (volatile jlong*)&dest_table()->_entries); } - size_t ShenandoahStrDedupShrinkTableTask::transfer_bucket(ShenandoahStrDedupEntry* volatile src, ShenandoahStrDedupEntry* volatile * dest) { ShenandoahStrDedupEntry* tmp; size_t transferred = 0; --- 406,415 ----
< prev index next >