--- old/src/share/vm/c1/c1_Compiler.cpp 2017-05-23 15:00:15.155147055 +0200 +++ new/src/share/vm/c1/c1_Compiler.cpp 2017-05-23 15:00:15.044143650 +0200 @@ -40,6 +40,7 @@ #include "runtime/arguments.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/sharedRuntime.hpp" +#include "utilities/bitMap.inline.hpp" Compiler::Compiler() : AbstractCompiler(compiler_c1) { --- old/src/share/vm/c1/c1_Optimizer.cpp 2017-05-23 15:00:15.731164726 +0200 +++ new/src/share/vm/c1/c1_Optimizer.cpp 2017-05-23 15:00:15.618161260 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,7 +26,7 @@ #include "c1/c1_Canonicalizer.hpp" #include "c1/c1_Optimizer.hpp" #include "c1/c1_ValueMap.hpp" -#include "c1/c1_ValueSet.hpp" +#include "c1/c1_ValueSet.inline.hpp" #include "c1/c1_ValueStack.hpp" #include "memory/resourceArea.hpp" #include "utilities/bitMap.inline.hpp" --- old/src/share/vm/c1/c1_ValueMap.cpp 2017-05-23 15:00:16.345183563 +0200 +++ new/src/share/vm/c1/c1_ValueMap.cpp 2017-05-23 15:00:16.233180127 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -26,8 +26,8 @@ #include "c1/c1_Canonicalizer.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_ValueMap.hpp" +#include "c1/c1_ValueSet.inline.hpp" #include "c1/c1_ValueStack.hpp" -#include "utilities/bitMap.inline.hpp" #ifndef PRODUCT --- old/src/share/vm/c1/c1_ValueSet.hpp 2017-05-23 15:00:16.926201388 +0200 +++ new/src/share/vm/c1/c1_ValueSet.hpp 2017-05-23 15:00:16.814197952 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -27,7 +27,7 @@ #include "c1/c1_Instruction.hpp" #include "memory/allocation.hpp" -#include "utilities/bitMap.inline.hpp" +#include "utilities/bitMap.hpp" // A ValueSet is a simple abstraction on top of a BitMap representing // a set of Instructions. Currently it assumes that the number of @@ -52,52 +52,4 @@ bool equals (ValueSet* other); }; -inline ValueSet::ValueSet() : _map(Instruction::number_of_instructions()) { -} - - -inline ValueSet* ValueSet::copy() { - ValueSet* res = new ValueSet(); - res->_map.set_from(_map); - return res; -} - - -inline bool ValueSet::contains(Value x) { - return _map.at(x->id()); -} - - -inline void ValueSet::put(Value x) { - _map.set_bit(x->id()); -} - - -inline void ValueSet::remove(Value x) { - _map.clear_bit(x->id()); -} - - -inline bool ValueSet::set_intersect(ValueSet* other) { - return _map.set_intersection_with_result(other->_map); -} - - -inline void ValueSet::set_union(ValueSet* other) { - _map.set_union(other->_map); -} - - -inline void ValueSet::clear() { - _map.clear(); -} - -inline void ValueSet::set_from(ValueSet* other) { - _map.set_from(other->_map); -} - -inline bool ValueSet::equals(ValueSet* other) { - return _map.is_same(other->_map); -} - #endif // SHARE_VM_C1_C1_VALUESET_HPP --- old/src/share/vm/classfile/classFileParser.cpp 2017-05-23 15:00:17.520219611 +0200 +++ new/src/share/vm/classfile/classFileParser.cpp 2017-05-23 15:00:17.402215991 +0200 @@ -64,6 +64,7 @@ #include "services/classLoadingService.hpp" #include "services/threadService.hpp" #include "trace/traceMacros.hpp" +#include "utilities/bitMap.inline.hpp" #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/growableArray.hpp" --- old/src/share/vm/gc/cms/concurrentMarkSweepGeneration.inline.hpp 2017-05-23 15:00:18.166239430 +0200 +++ new/src/share/vm/gc/cms/concurrentMarkSweepGeneration.inline.hpp 2017-05-23 15:00:18.054235994 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -32,6 +32,7 @@ #include "gc/cms/parNewGeneration.hpp" #include "gc/shared/gcUtil.hpp" #include "gc/shared/genCollectedHeap.hpp" +#include "utilities/bitMap.inline.hpp" inline void CMSBitMap::clear_all() { assert_locked(); --- old/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp 2017-05-23 15:00:18.756257531 +0200 +++ new/src/share/vm/gc/g1/g1ConcurrentMark.inline.hpp 2017-05-23 15:00:18.645254125 +0200 @@ -30,6 +30,7 @@ #include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" #include "gc/g1/suspendibleThreadSet.hpp" #include "gc/shared/taskqueue.inline.hpp" +#include "utilities/bitMap.inline.hpp" inline bool G1ConcurrentMark::par_mark(oop obj) { return _nextMarkBitMap->parMark((HeapWord*)obj); --- old/src/share/vm/gc/parallel/parMarkBitMap.cpp 2017-05-23 15:00:19.332275202 +0200 +++ new/src/share/vm/gc/parallel/parMarkBitMap.cpp 2017-05-23 15:00:19.221271797 +0200 @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "gc/parallel/parMarkBitMap.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "oops/oop.inline.hpp" --- old/src/share/vm/gc/parallel/parMarkBitMap.hpp 2017-05-23 15:00:19.916293119 +0200 +++ new/src/share/vm/gc/parallel/parMarkBitMap.hpp 2017-05-23 15:00:19.804289683 +0200 @@ -188,219 +188,4 @@ size_t _reserved_byte_size; }; -inline ParMarkBitMap::ParMarkBitMap(): - _beg_bits(), _end_bits(), _region_start(NULL), _region_size(0), _virtual_space(NULL), _reserved_byte_size(0) -{ } - -inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end) -{ - _beg_bits.clear_range(beg, end); - _end_bits.clear_range(beg, end); -} - -inline ParMarkBitMap::idx_t -ParMarkBitMap::bits_required(size_t words) -{ - // Need two bits (one begin bit, one end bit) for each unit of 'object - // granularity' in the heap. - return words_to_bits(words * 2); -} - -inline ParMarkBitMap::idx_t -ParMarkBitMap::bits_required(MemRegion covered_region) -{ - return bits_required(covered_region.word_size()); -} - -inline HeapWord* -ParMarkBitMap::region_start() const -{ - return _region_start; -} - -inline HeapWord* -ParMarkBitMap::region_end() const -{ - return region_start() + region_size(); -} - -inline size_t -ParMarkBitMap::region_size() const -{ - return _region_size; -} - -inline size_t -ParMarkBitMap::size() const -{ - return _beg_bits.size(); -} - -inline bool ParMarkBitMap::is_obj_beg(idx_t bit) const -{ - return _beg_bits.at(bit); -} - -inline bool ParMarkBitMap::is_obj_end(idx_t bit) const -{ - return _end_bits.at(bit); -} - -inline bool ParMarkBitMap::is_marked(idx_t bit) const -{ - return is_obj_beg(bit); -} - -inline bool ParMarkBitMap::is_marked(HeapWord* addr) const -{ - return is_marked(addr_to_bit(addr)); -} - -inline bool ParMarkBitMap::is_marked(oop obj) const -{ - return is_marked((HeapWord*)obj); -} - -inline bool ParMarkBitMap::is_unmarked(idx_t bit) const -{ - return !is_marked(bit); -} - -inline bool ParMarkBitMap::is_unmarked(HeapWord* addr) const -{ - return !is_marked(addr); -} - -inline bool ParMarkBitMap::is_unmarked(oop obj) const -{ - return !is_marked(obj); -} - -inline size_t -ParMarkBitMap::bits_to_words(idx_t bits) -{ - return bits << obj_granularity_shift(); -} - -inline ParMarkBitMap::idx_t -ParMarkBitMap::words_to_bits(size_t words) -{ - return words >> obj_granularity_shift(); -} - -inline size_t ParMarkBitMap::obj_size(idx_t beg_bit, idx_t end_bit) const -{ - DEBUG_ONLY(verify_bit(beg_bit);) - DEBUG_ONLY(verify_bit(end_bit);) - return bits_to_words(end_bit - beg_bit + 1); -} - -inline size_t -ParMarkBitMap::obj_size(HeapWord* beg_addr, HeapWord* end_addr) const -{ - DEBUG_ONLY(verify_addr(beg_addr);) - DEBUG_ONLY(verify_addr(end_addr);) - return pointer_delta(end_addr, beg_addr) + obj_granularity(); -} - -inline size_t ParMarkBitMap::obj_size(idx_t beg_bit) const -{ - const idx_t end_bit = _end_bits.get_next_one_offset(beg_bit, size()); - assert(is_marked(beg_bit), "obj not marked"); - assert(end_bit < size(), "end bit missing"); - return obj_size(beg_bit, end_bit); -} - -inline size_t ParMarkBitMap::obj_size(HeapWord* addr) const -{ - return obj_size(addr_to_bit(addr)); -} - -inline ParMarkBitMap::IterationStatus -ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, - HeapWord* range_beg, - HeapWord* range_end) const -{ - return iterate(live_closure, addr_to_bit(range_beg), addr_to_bit(range_end)); -} - -inline ParMarkBitMap::IterationStatus -ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, - ParMarkBitMapClosure* dead_closure, - HeapWord* range_beg, - HeapWord* range_end, - HeapWord* dead_range_end) const -{ - return iterate(live_closure, dead_closure, - addr_to_bit(range_beg), addr_to_bit(range_end), - addr_to_bit(dead_range_end)); -} - -inline bool -ParMarkBitMap::mark_obj(oop obj, int size) -{ - return mark_obj((HeapWord*)obj, (size_t)size); -} - -inline BitMap::idx_t -ParMarkBitMap::addr_to_bit(HeapWord* addr) const -{ - DEBUG_ONLY(verify_addr(addr);) - return words_to_bits(pointer_delta(addr, region_start())); -} - -inline HeapWord* -ParMarkBitMap::bit_to_addr(idx_t bit) const -{ - DEBUG_ONLY(verify_bit(bit);) - return region_start() + bits_to_words(bit); -} - -inline ParMarkBitMap::idx_t -ParMarkBitMap::find_obj_beg(idx_t beg, idx_t end) const -{ - return _beg_bits.get_next_one_offset_aligned_right(beg, end); -} - -inline ParMarkBitMap::idx_t -ParMarkBitMap::find_obj_end(idx_t beg, idx_t end) const -{ - return _end_bits.get_next_one_offset_aligned_right(beg, end); -} - -inline HeapWord* -ParMarkBitMap::find_obj_beg(HeapWord* beg, HeapWord* end) const -{ - const idx_t beg_bit = addr_to_bit(beg); - const idx_t end_bit = addr_to_bit(end); - const idx_t search_end = BitMap::word_align_up(end_bit); - const idx_t res_bit = MIN2(find_obj_beg(beg_bit, search_end), end_bit); - return bit_to_addr(res_bit); -} - -inline HeapWord* -ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const -{ - const idx_t beg_bit = addr_to_bit(beg); - const idx_t end_bit = addr_to_bit(end); - const idx_t search_end = BitMap::word_align_up(end_bit); - const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit); - return bit_to_addr(res_bit); -} - -#ifdef ASSERT -inline void ParMarkBitMap::verify_bit(idx_t bit) const { - // Allow one past the last valid bit; useful for loop bounds. - assert(bit <= _beg_bits.size(), "bit out of range"); -} - -inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { - // Allow one past the last valid address; useful for loop bounds. - assert(addr >= region_start(), - "addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())); - assert(addr <= region_end(), - "addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())); -} -#endif // #ifdef ASSERT - #endif // SHARE_VM_GC_PARALLEL_PARMARKBITMAP_HPP --- old/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp 2017-05-23 15:00:20.487310636 +0200 +++ new/src/share/vm/gc/parallel/parallelScavengeHeap.inline.hpp 2017-05-23 15:00:20.377307262 +0200 @@ -27,7 +27,7 @@ #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psMarkSweep.hpp" -#include "gc/parallel/psParallelCompact.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/parallel/psScavenge.hpp" inline size_t ParallelScavengeHeap::total_invocations() { --- old/src/share/vm/gc/parallel/pcTasks.cpp 2017-05-23 15:00:21.072328584 +0200 +++ new/src/share/vm/gc/parallel/pcTasks.cpp 2017-05-23 15:00:20.960325148 +0200 @@ -29,7 +29,7 @@ #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/pcTasks.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" -#include "gc/parallel/psParallelCompact.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" --- old/src/share/vm/gc/parallel/psCompactionManager.cpp 2017-05-23 15:00:21.632345764 +0200 +++ new/src/share/vm/gc/parallel/psCompactionManager.cpp 2017-05-23 15:00:21.522342389 +0200 @@ -26,7 +26,7 @@ #include "classfile/systemDictionary.hpp" #include "gc/parallel/gcTaskManager.hpp" #include "gc/parallel/objectStartArray.hpp" -#include "gc/parallel/parMarkBitMap.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psOldGen.hpp" --- old/src/share/vm/gc/parallel/psCompactionManager.inline.hpp 2017-05-23 15:00:22.218363742 +0200 +++ new/src/share/vm/gc/parallel/psCompactionManager.inline.hpp 2017-05-23 15:00:22.109360398 +0200 @@ -25,6 +25,7 @@ #ifndef SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP #define SHARE_VM_GC_PARALLEL_PSCOMPACTIONMANAGER_INLINE_HPP +#include "gc/parallel/parMarkBitMap.hpp" #include "gc/parallel/psCompactionManager.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" --- old/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp 2017-05-23 15:00:22.780380984 +0200 +++ new/src/share/vm/gc/parallel/psMarkSweepDecorator.cpp 2017-05-23 15:00:22.670377609 +0200 @@ -26,8 +26,10 @@ #include "classfile/systemDictionary.hpp" #include "gc/parallel/objectStartArray.hpp" #include "gc/parallel/parallelScavengeHeap.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psMarkSweep.hpp" #include "gc/parallel/psMarkSweepDecorator.hpp" +#include "gc/parallel/psParallelCompact.inline.hpp" #include "gc/serial/markSweep.inline.hpp" #include "gc/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" --- old/src/share/vm/gc/parallel/psParallelCompact.cpp 2017-05-23 15:00:23.351398502 +0200 +++ new/src/share/vm/gc/parallel/psParallelCompact.cpp 2017-05-23 15:00:23.236394973 +0200 @@ -30,6 +30,7 @@ #include "code/codeCache.hpp" #include "gc/parallel/gcTaskManager.hpp" #include "gc/parallel/parallelScavengeHeap.inline.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/pcTasks.hpp" #include "gc/parallel/psAdaptiveSizePolicy.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" @@ -3155,6 +3156,14 @@ return ParMarkBitMap::incomplete; } +FillClosure::FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) : + ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm), + _start_array(PSParallelCompact::start_array(space_id)) +{ + assert(space_id == PSParallelCompact::old_space_id, + "cannot use FillClosure in the young gen"); +} + ParMarkBitMapClosure::IterationStatus FillClosure::do_addr(HeapWord* addr, size_t size) { CollectedHeap::fill_with_objects(addr, size); --- old/src/share/vm/gc/parallel/psParallelCompact.hpp 2017-05-23 15:00:23.945416725 +0200 +++ new/src/share/vm/gc/parallel/psParallelCompact.hpp 2017-05-23 15:00:23.833413289 +0200 @@ -1253,73 +1253,6 @@ #endif // #ifdef ASSERT }; -inline bool PSParallelCompact::is_marked(oop obj) { - return mark_bitmap()->is_marked(obj); -} - -inline double PSParallelCompact::normal_distribution(double density) { - assert(_dwl_initialized, "uninitialized"); - const double squared_term = (density - _dwl_mean) / _dwl_std_dev; - return _dwl_first_term * exp(-0.5 * squared_term * squared_term); -} - -inline bool -PSParallelCompact::dead_space_crosses_boundary(const RegionData* region, - idx_t bit) -{ - assert(bit > 0, "cannot call this for the first bit/region"); - assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit), - "sanity check"); - - // Dead space crosses the boundary if (1) a partial object does not extend - // onto the region, (2) an object does not start at the beginning of the - // region, and (3) an object does not end at the end of the prior region. - return region->partial_obj_size() == 0 && - !_mark_bitmap.is_obj_beg(bit) && - !_mark_bitmap.is_obj_end(bit - 1); -} - -inline bool -PSParallelCompact::is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr) { - return p >= beg_addr && p < end_addr; -} - -inline bool -PSParallelCompact::is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr) { - return is_in((HeapWord*)p, beg_addr, end_addr); -} - -inline MutableSpace* PSParallelCompact::space(SpaceId id) { - assert(id < last_space_id, "id out of range"); - return _space_info[id].space(); -} - -inline HeapWord* PSParallelCompact::new_top(SpaceId id) { - assert(id < last_space_id, "id out of range"); - return _space_info[id].new_top(); -} - -inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) { - assert(id < last_space_id, "id out of range"); - return _space_info[id].dense_prefix(); -} - -inline ObjectStartArray* PSParallelCompact::start_array(SpaceId id) { - assert(id < last_space_id, "id out of range"); - return _space_info[id].start_array(); -} - -#ifdef ASSERT -inline void -PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) -{ - assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr), - "must move left or to a different space"); - assert(is_object_aligned((intptr_t)old_addr) && is_object_aligned((intptr_t)new_addr), - "checking alignment"); -} -#endif // ASSERT - class MoveAndUpdateClosure: public ParMarkBitMapClosure { public: inline MoveAndUpdateClosure(ParMarkBitMap* bitmap, ParCompactionManager* cm, @@ -1389,13 +1322,7 @@ class FillClosure: public ParMarkBitMapClosure { public: - FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) : - ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm), - _start_array(PSParallelCompact::start_array(space_id)) - { - assert(space_id == PSParallelCompact::old_space_id, - "cannot use FillClosure in the young gen"); - } + FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id); virtual IterationStatus do_addr(HeapWord* addr, size_t size); --- old/src/share/vm/gc/parallel/psParallelCompact.inline.hpp 2017-05-23 15:00:24.533434764 +0200 +++ new/src/share/vm/gc/parallel/psParallelCompact.inline.hpp 2017-05-23 15:00:24.418431236 +0200 @@ -26,11 +26,73 @@ #define SHARE_VM_GC_PARALLEL_PSPARALLELCOMPACT_INLINE_HPP #include "gc/parallel/parallelScavengeHeap.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psParallelCompact.hpp" #include "gc/shared/collectedHeap.hpp" #include "oops/klass.hpp" #include "oops/oop.inline.hpp" +inline bool PSParallelCompact::is_marked(oop obj) { + return mark_bitmap()->is_marked(obj); +} + +inline double PSParallelCompact::normal_distribution(double density) { + assert(_dwl_initialized, "uninitialized"); + const double squared_term = (density - _dwl_mean) / _dwl_std_dev; + return _dwl_first_term * exp(-0.5 * squared_term * squared_term); +} + +inline bool PSParallelCompact::dead_space_crosses_boundary(const RegionData* region, + idx_t bit) { + assert(bit > 0, "cannot call this for the first bit/region"); + assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit), + "sanity check"); + + // Dead space crosses the boundary if (1) a partial object does not extend + // onto the region, (2) an object does not start at the beginning of the + // region, and (3) an object does not end at the end of the prior region. + return region->partial_obj_size() == 0 && + !_mark_bitmap.is_obj_beg(bit) && + !_mark_bitmap.is_obj_end(bit - 1); +} + +inline bool PSParallelCompact::is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr) { + return p >= beg_addr && p < end_addr; +} + +inline bool PSParallelCompact::is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr) { + return is_in((HeapWord*)p, beg_addr, end_addr); +} + +inline MutableSpace* PSParallelCompact::space(SpaceId id) { + assert(id < last_space_id, "id out of range"); + return _space_info[id].space(); +} + +inline HeapWord* PSParallelCompact::new_top(SpaceId id) { + assert(id < last_space_id, "id out of range"); + return _space_info[id].new_top(); +} + +inline HeapWord* PSParallelCompact::dense_prefix(SpaceId id) { + assert(id < last_space_id, "id out of range"); + return _space_info[id].dense_prefix(); +} + +inline ObjectStartArray* PSParallelCompact::start_array(SpaceId id) { + assert(id < last_space_id, "id out of range"); + return _space_info[id].start_array(); +} + +#ifdef ASSERT +inline void PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr) { + assert(old_addr >= new_addr || space_id(old_addr) != space_id(new_addr), + "must move left or to a different space"); + assert(is_object_aligned((intptr_t)old_addr) && is_object_aligned((intptr_t)new_addr), + "checking alignment"); +} +#endif // ASSERT + inline bool PSParallelCompact::mark_obj(oop obj) { const int obj_size = obj->size(); if (mark_bitmap()->mark_obj(obj, obj_size)) { --- old/src/share/vm/gc/parallel/psPromotionManager.inline.hpp 2017-05-23 15:00:25.089451822 +0200 +++ new/src/share/vm/gc/parallel/psPromotionManager.inline.hpp 2017-05-23 15:00:24.980448478 +0200 @@ -26,6 +26,7 @@ #define SHARE_VM_GC_PARALLEL_PSPROMOTIONMANAGER_INLINE_HPP #include "gc/parallel/parallelScavengeHeap.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psOldGen.hpp" #include "gc/parallel/psPromotionLAB.inline.hpp" #include "gc/parallel/psPromotionManager.hpp" --- old/src/share/vm/oops/generateOopMap.cpp 2017-05-23 15:00:25.646468910 +0200 +++ new/src/share/vm/oops/generateOopMap.cpp 2017-05-23 15:00:25.535465505 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -28,13 +28,13 @@ #include "oops/generateOopMap.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" +#include "prims/methodHandles.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/relocator.hpp" #include "runtime/timerTrace.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/ostream.hpp" -#include "prims/methodHandles.hpp" // // @@ -437,6 +437,10 @@ } } +void GenerateOopMap::set_bbmark_bit(int bci) { + _bb_hdr_bits.at_put(bci, true); +} + void GenerateOopMap::reachable_basicblock(GenerateOopMap *c, int bci, int *data) { assert(bci>= 0 && bci < c->method()->code_size(), "index out of bounds"); BasicBlock* bb = c->get_basic_block_at(bci); --- old/src/share/vm/oops/generateOopMap.hpp 2017-05-23 15:00:26.265487901 +0200 +++ new/src/share/vm/oops/generateOopMap.hpp 2017-05-23 15:00:26.132483820 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -31,6 +31,7 @@ #include "oops/method.hpp" #include "oops/oopsHierarchy.hpp" #include "runtime/signature.hpp" +#include "utilities/bitMap.hpp" // Forward definition class GenerateOopMap; @@ -360,12 +361,7 @@ } int gc_points () const { return _gc_points; } int bb_count () const { return _bb_count; } - void set_bbmark_bit (int bci) { - _bb_hdr_bits.at_put(bci, true); - } - void clear_bbmark_bit (int bci) { - _bb_hdr_bits.at_put(bci, false); - } + void set_bbmark_bit (int bci); BasicBlock * get_basic_block_at (int bci) const; BasicBlock * get_basic_block_containing (int bci) const; void interp_bb (BasicBlock *bb); --- old/src/share/vm/oops/instanceKlass.hpp 2017-05-23 15:00:26.842505602 +0200 +++ new/src/share/vm/oops/instanceKlass.hpp 2017-05-23 15:00:26.726502044 +0200 @@ -40,7 +40,6 @@ #include "runtime/os.hpp" #include "trace/traceMacros.hpp" #include "utilities/accessFlags.hpp" -#include "utilities/bitMap.inline.hpp" #include "utilities/macros.hpp" // An InstanceKlass is the VM level representation of a Java class. --- old/test/native/gc/parallel/test_psParallelCompact.cpp 2017-05-23 15:00:27.451524286 +0200 +++ new/test/native/gc/parallel/test_psParallelCompact.cpp 2017-05-23 15:00:27.324520390 +0200 @@ -22,6 +22,7 @@ */ #include "precompiled.hpp" +#include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psParallelCompact.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "unittest.hpp" --- /dev/null 2017-05-05 09:07:19.163704162 +0200 +++ new/src/share/vm/c1/c1_ValueSet.inline.hpp 2017-05-23 15:00:27.910538368 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_C1_C1_VALUESET_INLINE_HPP +#define SHARE_VM_C1_C1_VALUESET_INLINE_HPP + +#include "c1/c1_Instruction.hpp" +#include "c1/c1_ValueSet.hpp" +#include "utilities/bitMap.inline.hpp" + +inline ValueSet::ValueSet() : _map(Instruction::number_of_instructions()) { +} + +inline ValueSet* ValueSet::copy() { + ValueSet* res = new ValueSet(); + res->_map.set_from(_map); + return res; +} + +inline bool ValueSet::contains(Value x) { + return _map.at(x->id()); +} + +inline void ValueSet::put(Value x) { + _map.set_bit(x->id()); +} + +inline void ValueSet::remove(Value x) { + _map.clear_bit(x->id()); +} + +inline bool ValueSet::set_intersect(ValueSet* other) { + return _map.set_intersection_with_result(other->_map); +} + +inline void ValueSet::set_union(ValueSet* other) { + _map.set_union(other->_map); +} + +inline void ValueSet::clear() { + _map.clear(); +} + +inline void ValueSet::set_from(ValueSet* other) { + _map.set_from(other->_map); +} + +inline bool ValueSet::equals(ValueSet* other) { + return _map.is_same(other->_map); +} + +#endif // SHARE_VM_C1_C1_VALUESET_INLINE_HPP --- /dev/null 2017-05-05 09:07:19.163704162 +0200 +++ new/src/share/vm/gc/parallel/parMarkBitMap.inline.hpp 2017-05-23 15:00:28.465555395 +0200 @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2017, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_PARALLEL_PARMARKBITMAP_INLINE_HPP +#define SHARE_VM_GC_PARALLEL_PARMARKBITMAP_INLINE_HPP + +#include "gc/parallel/parMarkBitMap.hpp" +#include "utilities/bitMap.inline.hpp" + +inline ParMarkBitMap::ParMarkBitMap(): + _beg_bits(), _end_bits(), _region_start(NULL), _region_size(0), _virtual_space(NULL), _reserved_byte_size(0) +{ } + +inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end) { + _beg_bits.clear_range(beg, end); + _end_bits.clear_range(beg, end); +} + +inline ParMarkBitMap::idx_t ParMarkBitMap::bits_required(size_t words) { + // Need two bits (one begin bit, one end bit) for each unit of 'object + // granularity' in the heap. + return words_to_bits(words * 2); +} + +inline ParMarkBitMap::idx_t ParMarkBitMap::bits_required(MemRegion covered_region) { + return bits_required(covered_region.word_size()); +} + +inline HeapWord* ParMarkBitMap::region_start() const { + return _region_start; +} + +inline HeapWord* ParMarkBitMap::region_end() const { + return region_start() + region_size(); +} + +inline size_t ParMarkBitMap::region_size() const { + return _region_size; +} + +inline size_t ParMarkBitMap::size() const { + return _beg_bits.size(); +} + +inline bool ParMarkBitMap::is_obj_beg(idx_t bit) const { + return _beg_bits.at(bit); +} + +inline bool ParMarkBitMap::is_obj_end(idx_t bit) const { + return _end_bits.at(bit); +} + +inline bool ParMarkBitMap::is_marked(idx_t bit) const { + return is_obj_beg(bit); +} + +inline bool ParMarkBitMap::is_marked(HeapWord* addr) const { + return is_marked(addr_to_bit(addr)); +} + +inline bool ParMarkBitMap::is_marked(oop obj) const { + return is_marked((HeapWord*)obj); +} + +inline bool ParMarkBitMap::is_unmarked(idx_t bit) const { + return !is_marked(bit); +} + +inline bool ParMarkBitMap::is_unmarked(HeapWord* addr) const { + return !is_marked(addr); +} + +inline bool ParMarkBitMap::is_unmarked(oop obj) const { + return !is_marked(obj); +} + +inline size_t ParMarkBitMap::bits_to_words(idx_t bits) { + return bits << obj_granularity_shift(); +} + +inline ParMarkBitMap::idx_t ParMarkBitMap::words_to_bits(size_t words) { + return words >> obj_granularity_shift(); +} + +inline size_t ParMarkBitMap::obj_size(idx_t beg_bit, idx_t end_bit) const { + DEBUG_ONLY(verify_bit(beg_bit);) + DEBUG_ONLY(verify_bit(end_bit);) + return bits_to_words(end_bit - beg_bit + 1); +} + +inline size_t ParMarkBitMap::obj_size(HeapWord* beg_addr, HeapWord* end_addr) const { + DEBUG_ONLY(verify_addr(beg_addr);) + DEBUG_ONLY(verify_addr(end_addr);) + return pointer_delta(end_addr, beg_addr) + obj_granularity(); +} + +inline size_t ParMarkBitMap::obj_size(idx_t beg_bit) const { + const idx_t end_bit = _end_bits.get_next_one_offset(beg_bit, size()); + assert(is_marked(beg_bit), "obj not marked"); + assert(end_bit < size(), "end bit missing"); + return obj_size(beg_bit, end_bit); +} + +inline size_t ParMarkBitMap::obj_size(HeapWord* addr) const { + return obj_size(addr_to_bit(addr)); +} + +inline ParMarkBitMap::IterationStatus ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, + HeapWord* range_beg, + HeapWord* range_end) const { + return iterate(live_closure, addr_to_bit(range_beg), addr_to_bit(range_end)); +} + +inline ParMarkBitMap::IterationStatus ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure, + ParMarkBitMapClosure* dead_closure, + HeapWord* range_beg, + HeapWord* range_end, + HeapWord* dead_range_end) const { + return iterate(live_closure, dead_closure, + addr_to_bit(range_beg), addr_to_bit(range_end), + addr_to_bit(dead_range_end)); +} + +inline bool ParMarkBitMap::mark_obj(oop obj, int size) { + return mark_obj((HeapWord*)obj, (size_t)size); +} + +inline BitMap::idx_t ParMarkBitMap::addr_to_bit(HeapWord* addr) const { + DEBUG_ONLY(verify_addr(addr);) + return words_to_bits(pointer_delta(addr, region_start())); +} + +inline HeapWord* ParMarkBitMap::bit_to_addr(idx_t bit) const { + DEBUG_ONLY(verify_bit(bit);) + return region_start() + bits_to_words(bit); +} + +inline ParMarkBitMap::idx_t ParMarkBitMap::find_obj_beg(idx_t beg, idx_t end) const { + return _beg_bits.get_next_one_offset_aligned_right(beg, end); +} + +inline ParMarkBitMap::idx_t ParMarkBitMap::find_obj_end(idx_t beg, idx_t end) const { + return _end_bits.get_next_one_offset_aligned_right(beg, end); +} + +inline HeapWord* ParMarkBitMap::find_obj_beg(HeapWord* beg, HeapWord* end) const { + const idx_t beg_bit = addr_to_bit(beg); + const idx_t end_bit = addr_to_bit(end); + const idx_t search_end = BitMap::word_align_up(end_bit); + const idx_t res_bit = MIN2(find_obj_beg(beg_bit, search_end), end_bit); + return bit_to_addr(res_bit); +} + +inline HeapWord* ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const { + const idx_t beg_bit = addr_to_bit(beg); + const idx_t end_bit = addr_to_bit(end); + const idx_t search_end = BitMap::word_align_up(end_bit); + const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit); + return bit_to_addr(res_bit); +} + +#ifdef ASSERT +inline void ParMarkBitMap::verify_bit(idx_t bit) const { + // Allow one past the last valid bit; useful for loop bounds. + assert(bit <= _beg_bits.size(), "bit out of range"); +} + +inline void ParMarkBitMap::verify_addr(HeapWord* addr) const { + // Allow one past the last valid address; useful for loop bounds. + assert(addr >= region_start(), + "addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())); + assert(addr <= region_end(), + "addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())); +} +#endif // #ifdef ASSERT + +#endif /* SHARE_VM_GC_PARALLEL_PARMARKBITMAP_INLINE_HPP */