Merge
This commit is contained in:
commit
a22ed33318
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -74,7 +74,7 @@ void StackMapFrame::initialize_object(
|
||||
}
|
||||
|
||||
VerificationType StackMapFrame::set_locals_from_arg(
|
||||
const methodHandle m, VerificationType thisKlass, TRAPS) {
|
||||
const methodHandle& m, VerificationType thisKlass, TRAPS) {
|
||||
SignatureStream ss(m->signature());
|
||||
int init_local_num = 0;
|
||||
if (!m->is_static()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -152,7 +152,7 @@ class StackMapFrame : public ResourceObj {
|
||||
|
||||
// Set local variable type array based on m's signature.
|
||||
VerificationType set_locals_from_arg(
|
||||
const methodHandle m, VerificationType thisKlass, TRAPS);
|
||||
const methodHandle& m, VerificationType thisKlass, TRAPS);
|
||||
|
||||
// Search local variable type array and stack type array.
|
||||
// Set every element with type of old_object to new_object.
|
||||
|
@ -1745,7 +1745,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
|
||||
|
||||
#undef bad_type_message
|
||||
|
||||
char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) {
|
||||
char* ClassVerifier::generate_code_data(const methodHandle& m, u4 code_length, TRAPS) {
|
||||
char* code_data = NEW_RESOURCE_ARRAY(char, code_length);
|
||||
memset(code_data, 0, sizeof(char) * code_length);
|
||||
RawBytecodeStream bcs(m);
|
||||
@ -1814,9 +1814,9 @@ void ClassVerifier::verify_exception_handler_table(u4 code_length, char* code_da
|
||||
}
|
||||
|
||||
void ClassVerifier::verify_local_variable_table(u4 code_length, char* code_data, TRAPS) {
|
||||
int localvariable_table_length = _method()->localvariable_table_length();
|
||||
int localvariable_table_length = _method->localvariable_table_length();
|
||||
if (localvariable_table_length > 0) {
|
||||
LocalVariableTableElement* table = _method()->localvariable_table_start();
|
||||
LocalVariableTableElement* table = _method->localvariable_table_start();
|
||||
for (int i = 0; i < localvariable_table_length; i++) {
|
||||
u2 start_bci = table[i].start_bci;
|
||||
u2 length = table[i].length;
|
||||
|
@ -264,7 +264,7 @@ class ClassVerifier : public StackObj {
|
||||
ErrorContext _error_context; // contains information about an error
|
||||
|
||||
void verify_method(const methodHandle& method, TRAPS);
|
||||
char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
|
||||
char* generate_code_data(const methodHandle& m, u4 code_length, TRAPS);
|
||||
void verify_exception_handler_table(u4 code_length, char* code_data,
|
||||
int& min, int& max, TRAPS);
|
||||
void verify_local_variable_table(u4 code_length, char* code_data, TRAPS);
|
||||
@ -378,7 +378,7 @@ class ClassVerifier : public StackObj {
|
||||
~ClassVerifier();
|
||||
|
||||
Thread* thread() { return _thread; }
|
||||
methodHandle method() { return _method; }
|
||||
const methodHandle& method() { return _method; }
|
||||
instanceKlassHandle current_class() const { return _klass; }
|
||||
VerificationType current_type() const { return _this_type; }
|
||||
|
||||
|
@ -2730,7 +2730,7 @@ class CMSPhaseAccounting: public StackObj {
|
||||
public:
|
||||
// Not MT-safe; so do not pass around these StackObj's
|
||||
// where they may be accessed by other threads.
|
||||
jlong wallclock_millis() {
|
||||
double wallclock_millis() {
|
||||
return TimeHelper::counter_to_millis(os::elapsed_counter() - _trace_time.start_time());
|
||||
}
|
||||
};
|
||||
|
@ -291,6 +291,10 @@ double G1CollectorPolicy::get_new_prediction(TruncatedSeq const* seq) const {
|
||||
return _predictor.get_new_prediction(seq);
|
||||
}
|
||||
|
||||
size_t G1CollectorPolicy::get_new_size_prediction(TruncatedSeq const* seq) const {
|
||||
return (size_t)get_new_prediction(seq);
|
||||
}
|
||||
|
||||
void G1CollectorPolicy::initialize_alignments() {
|
||||
_space_alignment = HeapRegion::GrainBytes;
|
||||
size_t card_table_alignment = CardTableRS::ct_max_alignment_constraint();
|
||||
@ -477,7 +481,7 @@ bool G1CollectorPolicy::predict_will_fit(uint young_length,
|
||||
// (100 + TargetPLABWastePct) represents the increase in expected bytes during
|
||||
// copying due to anticipated waste in the PLABs.
|
||||
double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0;
|
||||
size_t expected_bytes_to_copy = safety_factor * bytes_to_copy;
|
||||
size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy);
|
||||
|
||||
if (expected_bytes_to_copy > free_bytes) {
|
||||
// end condition 3: out-of-space
|
||||
@ -524,7 +528,7 @@ uint G1CollectorPolicy::calculate_young_list_desired_max_length() const {
|
||||
}
|
||||
|
||||
uint G1CollectorPolicy::update_young_list_max_and_target_length() {
|
||||
return update_young_list_max_and_target_length(get_new_prediction(_rs_lengths_seq));
|
||||
return update_young_list_max_and_target_length(get_new_size_prediction(_rs_lengths_seq));
|
||||
}
|
||||
|
||||
uint G1CollectorPolicy::update_young_list_max_and_target_length(size_t rs_lengths) {
|
||||
@ -629,7 +633,7 @@ G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths,
|
||||
|
||||
double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0;
|
||||
double survivor_regions_evac_time = predict_survivor_regions_evac_time();
|
||||
size_t pending_cards = (size_t) get_new_prediction(_pending_cards_seq);
|
||||
size_t pending_cards = get_new_size_prediction(_pending_cards_seq);
|
||||
size_t adj_rs_lengths = rs_lengths + predict_rs_length_diff();
|
||||
size_t scanned_cards = predict_young_card_num(adj_rs_lengths);
|
||||
double base_time_ms =
|
||||
@ -732,7 +736,7 @@ void G1CollectorPolicy::revise_young_list_target_length_if_necessary() {
|
||||
}
|
||||
|
||||
void G1CollectorPolicy::update_rs_lengths_prediction() {
|
||||
update_rs_lengths_prediction(get_new_prediction(_rs_lengths_seq));
|
||||
update_rs_lengths_prediction(get_new_size_prediction(_rs_lengths_seq));
|
||||
}
|
||||
|
||||
void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) {
|
||||
@ -1345,7 +1349,7 @@ void G1CollectorPolicy::adjust_concurrent_refinement(double update_rs_time,
|
||||
}
|
||||
|
||||
size_t G1CollectorPolicy::predict_rs_length_diff() const {
|
||||
return (size_t) get_new_prediction(_rs_length_diff_seq);
|
||||
return get_new_size_prediction(_rs_length_diff_seq);
|
||||
}
|
||||
|
||||
double G1CollectorPolicy::predict_alloc_rate_ms() const {
|
||||
|
@ -179,6 +179,7 @@ class G1CollectorPolicy: public CollectorPolicy {
|
||||
G1Predictions _predictor;
|
||||
|
||||
double get_new_prediction(TruncatedSeq const* seq) const;
|
||||
size_t get_new_size_prediction(TruncatedSeq const* seq) const;
|
||||
|
||||
// either equal to the number of parallel threads, if ParallelGCThreads
|
||||
// has been set, or 1 otherwise
|
||||
|
75
hotspot/src/share/vm/gc/g1/g1FromCardCache.cpp
Normal file
75
hotspot/src/share/vm/gc/g1/g1FromCardCache.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/g1/g1FromCardCache.hpp"
|
||||
#include "gc/g1/heapRegionRemSet.hpp"
|
||||
#include "memory/padded.inline.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
int** G1FromCardCache::_cache = NULL;
|
||||
uint G1FromCardCache::_max_regions = 0;
|
||||
size_t G1FromCardCache::_static_mem_size = 0;
|
||||
|
||||
void G1FromCardCache::initialize(uint n_par_rs, uint max_num_regions) {
|
||||
guarantee(_cache == NULL, "Should not call this multiple times");
|
||||
|
||||
_max_regions = max_num_regions;
|
||||
_cache = Padded2DArray<int, mtGC>::create_unfreeable(n_par_rs,
|
||||
_max_regions,
|
||||
&_static_mem_size);
|
||||
|
||||
invalidate(0, _max_regions);
|
||||
}
|
||||
|
||||
void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
|
||||
guarantee((size_t)start_idx + new_num_regions <= max_uintx,
|
||||
"Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT,
|
||||
start_idx, new_num_regions);
|
||||
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
|
||||
uint end_idx = (start_idx + (uint)new_num_regions);
|
||||
assert(end_idx <= _max_regions, "Must be within max.");
|
||||
for (uint j = start_idx; j < end_idx; j++) {
|
||||
set(i, j, InvalidCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void G1FromCardCache::print(outputStream* out) {
|
||||
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
|
||||
for (uint j = 0; j < _max_regions; j++) {
|
||||
out->print_cr("_from_card_cache[%u][%u] = %d.",
|
||||
i, j, at(i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void G1FromCardCache::clear(uint region_idx) {
|
||||
uint num_par_remsets = HeapRegionRemSet::num_par_rem_sets();
|
||||
for (uint i = 0; i < num_par_remsets; i++) {
|
||||
set(i, region_idx, InvalidCard);
|
||||
}
|
||||
}
|
79
hotspot/src/share/vm/gc/g1/g1FromCardCache.hpp
Normal file
79
hotspot/src/share/vm/gc/g1/g1FromCardCache.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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.
|
||||
*
|
||||
* 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_G1_G1FROMCARDCACHE_HPP
|
||||
#define SHARE_VM_GC_G1_G1FROMCARDCACHE_HPP
|
||||
|
||||
#include "memory/allocation.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
// G1FromCardCache remembers the most recently processed card on the heap on
|
||||
// a per-region and per-thread basis.
|
||||
class G1FromCardCache : public AllStatic {
|
||||
private:
|
||||
// Array of card indices. Indexed by thread X and heap region to minimize
|
||||
// thread contention.
|
||||
static int** _cache;
|
||||
static uint _max_regions;
|
||||
static size_t _static_mem_size;
|
||||
|
||||
public:
|
||||
enum {
|
||||
InvalidCard = -1 // Card value of an invalid card, i.e. a card index not otherwise used.
|
||||
};
|
||||
|
||||
static void clear(uint region_idx);
|
||||
|
||||
// Returns true if the given card is in the cache at the given location, or
|
||||
// replaces the card at that location and returns false.
|
||||
static bool contains_or_replace(uint worker_id, uint region_idx, int card) {
|
||||
int card_in_cache = at(worker_id, region_idx);
|
||||
if (card_in_cache == card) {
|
||||
return true;
|
||||
} else {
|
||||
set(worker_id, region_idx, card);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int at(uint worker_id, uint region_idx) {
|
||||
return _cache[worker_id][region_idx];
|
||||
}
|
||||
|
||||
static void set(uint worker_id, uint region_idx, int val) {
|
||||
_cache[worker_id][region_idx] = val;
|
||||
}
|
||||
|
||||
static void initialize(uint n_par_rs, uint max_num_regions);
|
||||
|
||||
static void invalidate(uint start_idx, size_t num_regions);
|
||||
|
||||
static void print(outputStream* out = tty) PRODUCT_RETURN;
|
||||
|
||||
static size_t static_mem_size() {
|
||||
return _static_mem_size;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_G1_G1FROMCARDCACHE_HPP
|
@ -138,7 +138,7 @@ size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
|
||||
|
||||
double safe_total_heap_percentage = MIN2((double)(_heap_reserve_percent + _heap_waste_percent), 100.0);
|
||||
|
||||
return MIN2(
|
||||
return (size_t)MIN2(
|
||||
G1CollectedHeap::heap()->max_capacity() * (100.0 - safe_total_heap_percentage) / 100.0,
|
||||
_target_occupancy * (100.0 - _heap_waste_percent) / 100.0
|
||||
);
|
||||
@ -153,10 +153,13 @@ size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() {
|
||||
if (have_enough_data_for_prediction()) {
|
||||
double pred_marking_time = _predictor->get_new_prediction(&_marking_times_s);
|
||||
double pred_promotion_rate = _predictor->get_new_prediction(&_allocation_rate_s);
|
||||
size_t pred_promotion_size = (size_t)(pred_marking_time * pred_promotion_rate);
|
||||
|
||||
size_t predicted_needed_bytes_during_marking =
|
||||
(pred_marking_time * pred_promotion_rate +
|
||||
_last_unrestrained_young_size); // In reality we would need the maximum size of the young gen during marking. This is a conservative estimate.
|
||||
pred_promotion_size +
|
||||
// In reality we would need the maximum size of the young gen during
|
||||
// marking. This is a conservative estimate.
|
||||
_last_unrestrained_young_size;
|
||||
|
||||
size_t internal_threshold = actual_target_threshold();
|
||||
size_t predicted_initiating_threshold = predicted_needed_bytes_during_marking < internal_threshold ?
|
||||
@ -165,11 +168,13 @@ size_t G1AdaptiveIHOPControl::get_conc_mark_start_threshold() {
|
||||
return predicted_initiating_threshold;
|
||||
} else {
|
||||
// Use the initial value.
|
||||
return _initial_ihop_percent * _target_occupancy / 100.0;
|
||||
return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
|
||||
}
|
||||
}
|
||||
|
||||
void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
|
||||
void G1AdaptiveIHOPControl::update_allocation_info(double allocation_time_s,
|
||||
size_t allocated_bytes,
|
||||
size_t additional_buffer_size) {
|
||||
G1IHOPControl::update_allocation_info(allocation_time_s, allocated_bytes, additional_buffer_size);
|
||||
|
||||
double allocation_rate = (double) allocated_bytes / allocation_time_s;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gc/g1/g1HotCardCache.hpp"
|
||||
#include "gc/g1/g1OopClosures.inline.hpp"
|
||||
#include "gc/g1/g1RemSet.inline.hpp"
|
||||
#include "gc/g1/heapRegion.inline.hpp"
|
||||
#include "gc/g1/heapRegionManager.inline.hpp"
|
||||
#include "gc/g1/heapRegionRemSet.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
@ -40,13 +41,15 @@
|
||||
#include "utilities/intHisto.hpp"
|
||||
#include "utilities/stack.inline.hpp"
|
||||
|
||||
G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs)
|
||||
: _g1(g1), _conc_refine_cards(0),
|
||||
_ct_bs(ct_bs), _g1p(_g1->g1_policy()),
|
||||
_cg1r(g1->concurrent_g1_refine()),
|
||||
_cset_rs_update_cl(NULL),
|
||||
_prev_period_summary(),
|
||||
_into_cset_dirty_card_queue_set(false)
|
||||
G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) :
|
||||
_g1(g1),
|
||||
_conc_refine_cards(0),
|
||||
_ct_bs(ct_bs),
|
||||
_g1p(_g1->g1_policy()),
|
||||
_cg1r(g1->concurrent_g1_refine()),
|
||||
_cset_rs_update_cl(NULL),
|
||||
_prev_period_summary(),
|
||||
_into_cset_dirty_card_queue_set(false)
|
||||
{
|
||||
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
|
||||
for (uint i = 0; i < n_workers(); i++) {
|
||||
@ -76,13 +79,13 @@ G1RemSet::~G1RemSet() {
|
||||
ScanRSClosure::ScanRSClosure(G1ParPushHeapRSClosure* oc,
|
||||
CodeBlobClosure* code_root_cl,
|
||||
uint worker_i) :
|
||||
_oc(oc),
|
||||
_code_root_cl(code_root_cl),
|
||||
_strong_code_root_scan_time_sec(0.0),
|
||||
_cards(0),
|
||||
_cards_done(0),
|
||||
_worker_i(worker_i),
|
||||
_try_claimed(false) {
|
||||
_oc(oc),
|
||||
_code_root_cl(code_root_cl),
|
||||
_strong_code_root_scan_time_sec(0.0),
|
||||
_cards(0),
|
||||
_cards_done(0),
|
||||
_worker_i(worker_i),
|
||||
_try_claimed(false) {
|
||||
_g1h = G1CollectedHeap::heap();
|
||||
_bot_shared = _g1h->bot_shared();
|
||||
_ct_bs = _g1h->g1_barrier_set();
|
||||
|
@ -25,15 +25,25 @@
|
||||
#ifndef SHARE_VM_GC_G1_G1REMSET_HPP
|
||||
#define SHARE_VM_GC_G1_G1REMSET_HPP
|
||||
|
||||
#include "gc/g1/dirtyCardQueue.hpp"
|
||||
#include "gc/g1/g1RemSetSummary.hpp"
|
||||
#include "gc/g1/heapRegion.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
|
||||
// A G1RemSet provides ways of iterating over pointers into a selected
|
||||
// collection set.
|
||||
|
||||
class G1CollectedHeap;
|
||||
class BitMap;
|
||||
class CardTableModRefBS;
|
||||
class G1BlockOffsetSharedArray;
|
||||
class ConcurrentG1Refine;
|
||||
class CodeBlobClosure;
|
||||
class G1CollectedHeap;
|
||||
class G1CollectorPolicy;
|
||||
class G1ParPushHeapRSClosure;
|
||||
class outputStream;
|
||||
class G1SATBCardTableModRefBS;
|
||||
class HeapRegionClaimer;
|
||||
|
||||
// A G1RemSet in which each heap region has a rem set that records the
|
||||
// external heap references into it. Uses a mod ref bs to track updates,
|
||||
|
@ -351,58 +351,12 @@ void OtherRegionsTable::unlink_from_all(PerRegionTable* prt) {
|
||||
"just checking");
|
||||
}
|
||||
|
||||
int** FromCardCache::_cache = NULL;
|
||||
uint FromCardCache::_max_regions = 0;
|
||||
size_t FromCardCache::_static_mem_size = 0;
|
||||
|
||||
void FromCardCache::initialize(uint n_par_rs, uint max_num_regions) {
|
||||
guarantee(_cache == NULL, "Should not call this multiple times");
|
||||
|
||||
_max_regions = max_num_regions;
|
||||
_cache = Padded2DArray<int, mtGC>::create_unfreeable(n_par_rs,
|
||||
_max_regions,
|
||||
&_static_mem_size);
|
||||
|
||||
invalidate(0, _max_regions);
|
||||
}
|
||||
|
||||
void FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
|
||||
guarantee((size_t)start_idx + new_num_regions <= max_uintx,
|
||||
"Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT,
|
||||
start_idx, new_num_regions);
|
||||
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
|
||||
uint end_idx = (start_idx + (uint)new_num_regions);
|
||||
assert(end_idx <= _max_regions, "Must be within max.");
|
||||
for (uint j = start_idx; j < end_idx; j++) {
|
||||
set(i, j, InvalidCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void FromCardCache::print(outputStream* out) {
|
||||
for (uint i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) {
|
||||
for (uint j = 0; j < _max_regions; j++) {
|
||||
out->print_cr("_from_card_cache[%u][%u] = %d.",
|
||||
i, j, at(i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void FromCardCache::clear(uint region_idx) {
|
||||
uint num_par_remsets = HeapRegionRemSet::num_par_rem_sets();
|
||||
for (uint i = 0; i < num_par_remsets; i++) {
|
||||
set(i, region_idx, InvalidCard);
|
||||
}
|
||||
}
|
||||
|
||||
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
|
||||
uint cur_hrm_ind = _hr->hrm_index();
|
||||
|
||||
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
|
||||
|
||||
if (FromCardCache::contains_or_replace(tid, cur_hrm_ind, from_card)) {
|
||||
if (G1FromCardCache::contains_or_replace(tid, cur_hrm_ind, from_card)) {
|
||||
assert(contains_reference(from), "We just added it!");
|
||||
return;
|
||||
}
|
||||
@ -668,7 +622,7 @@ size_t OtherRegionsTable::mem_size() const {
|
||||
}
|
||||
|
||||
size_t OtherRegionsTable::static_mem_size() {
|
||||
return FromCardCache::static_mem_size();
|
||||
return G1FromCardCache::static_mem_size();
|
||||
}
|
||||
|
||||
size_t OtherRegionsTable::fl_mem_size() {
|
||||
@ -676,7 +630,7 @@ size_t OtherRegionsTable::fl_mem_size() {
|
||||
}
|
||||
|
||||
void OtherRegionsTable::clear_fcc() {
|
||||
FromCardCache::clear(_hr->hrm_index());
|
||||
G1FromCardCache::clear(_hr->hrm_index());
|
||||
}
|
||||
|
||||
void OtherRegionsTable::clear() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define SHARE_VM_GC_G1_HEAPREGIONREMSET_HPP
|
||||
|
||||
#include "gc/g1/g1CodeCacheRemSet.hpp"
|
||||
#include "gc/g1/g1FromCardCache.hpp"
|
||||
#include "gc/g1/sparsePRT.hpp"
|
||||
|
||||
// Remembered set for a heap region. Represent a set of "cards" that
|
||||
@ -45,54 +46,6 @@ class nmethod;
|
||||
class HRRSCleanupTask : public SparsePRTCleanupTask {
|
||||
};
|
||||
|
||||
// The FromCardCache remembers the most recently processed card on the heap on
|
||||
// a per-region and per-thread basis.
|
||||
class FromCardCache : public AllStatic {
|
||||
private:
|
||||
// Array of card indices. Indexed by thread X and heap region to minimize
|
||||
// thread contention.
|
||||
static int** _cache;
|
||||
static uint _max_regions;
|
||||
static size_t _static_mem_size;
|
||||
|
||||
public:
|
||||
enum {
|
||||
InvalidCard = -1 // Card value of an invalid card, i.e. a card index not otherwise used.
|
||||
};
|
||||
|
||||
static void clear(uint region_idx);
|
||||
|
||||
// Returns true if the given card is in the cache at the given location, or
|
||||
// replaces the card at that location and returns false.
|
||||
static bool contains_or_replace(uint worker_id, uint region_idx, int card) {
|
||||
int card_in_cache = at(worker_id, region_idx);
|
||||
if (card_in_cache == card) {
|
||||
return true;
|
||||
} else {
|
||||
set(worker_id, region_idx, card);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static int at(uint worker_id, uint region_idx) {
|
||||
return _cache[worker_id][region_idx];
|
||||
}
|
||||
|
||||
static void set(uint worker_id, uint region_idx, int val) {
|
||||
_cache[worker_id][region_idx] = val;
|
||||
}
|
||||
|
||||
static void initialize(uint n_par_rs, uint max_num_regions);
|
||||
|
||||
static void invalidate(uint start_idx, size_t num_regions);
|
||||
|
||||
static void print(outputStream* out = tty) PRODUCT_RETURN;
|
||||
|
||||
static size_t static_mem_size() {
|
||||
return _static_mem_size;
|
||||
}
|
||||
};
|
||||
|
||||
// The "_coarse_map" is a bitmap with one bit for each region, where set
|
||||
// bits indicate that the corresponding region may contain some pointer
|
||||
// into the owning region.
|
||||
@ -371,16 +324,16 @@ public:
|
||||
// Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
|
||||
// (Uses it to initialize from_card_cache).
|
||||
static void init_heap(uint max_regions) {
|
||||
FromCardCache::initialize(num_par_rem_sets(), max_regions);
|
||||
G1FromCardCache::initialize(num_par_rem_sets(), max_regions);
|
||||
}
|
||||
|
||||
static void invalidate_from_card_cache(uint start_idx, size_t num_regions) {
|
||||
FromCardCache::invalidate(start_idx, num_regions);
|
||||
G1FromCardCache::invalidate(start_idx, num_regions);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
static void print_from_card_cache() {
|
||||
FromCardCache::print();
|
||||
G1FromCardCache::print();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -278,7 +278,7 @@ void G1NewTracer::send_basic_ihop_statistics(size_t threshold,
|
||||
evt.set_gcId(GCId::current());
|
||||
evt.set_threshold(threshold);
|
||||
evt.set_targetOccupancy(target_occupancy);
|
||||
evt.set_thresholdPercentage(target_occupancy > 0 ? threshold * 100.0 / target_occupancy : 0.0);
|
||||
evt.set_thresholdPercentage(target_occupancy > 0 ? (threshold * 100 / target_occupancy) : 0);
|
||||
evt.set_currentOccupancy(current_occupancy);
|
||||
evt.set_lastAllocationSize(last_allocation_size);
|
||||
evt.set_lastAllocationDuration(last_allocation_duration);
|
||||
@ -299,7 +299,7 @@ void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold,
|
||||
if (evt.should_commit()) {
|
||||
evt.set_gcId(GCId::current());
|
||||
evt.set_threshold(threshold);
|
||||
evt.set_thresholdPercentage(internal_target_occupancy > 0 ? threshold * 100.0 / internal_target_occupancy : 0.0);
|
||||
evt.set_thresholdPercentage(internal_target_occupancy > 0 ? (threshold * 100 / internal_target_occupancy) : 0);
|
||||
evt.set_internalTargetOccupancy(internal_target_occupancy);
|
||||
evt.set_currentOccupancy(current_occupancy);
|
||||
evt.set_additionalBufferSize(additional_buffer_size);
|
||||
|
@ -86,7 +86,7 @@ class BaseBytecodeStream: StackObj {
|
||||
bool is_raw() const { return _is_raw; }
|
||||
|
||||
// Stream attributes
|
||||
methodHandle method() const { return _method; }
|
||||
const methodHandle& method() const { return _method; }
|
||||
|
||||
int bci() const { return _bci; }
|
||||
int next_bci() const { return _next_bci; }
|
||||
|
@ -46,9 +46,58 @@ Handle::Handle(Thread* thread, oop obj) {
|
||||
_handle = thread->handle_area()->allocate_handle(obj);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Copy constructors and destructors for metadata handles
|
||||
// These do too much to inline.
|
||||
#define DEF_METADATA_HANDLE_FN_NOINLINE(name, type) \
|
||||
name##Handle::name##Handle(const name##Handle &h) { \
|
||||
_value = h._value; \
|
||||
if (_value != NULL) { \
|
||||
assert(_value->is_valid(), "obj is valid"); \
|
||||
if (h._thread != NULL) { \
|
||||
assert(h._thread == Thread::current(), "thread must be current");\
|
||||
_thread = h._thread; \
|
||||
} else { \
|
||||
_thread = Thread::current(); \
|
||||
} \
|
||||
assert (_thread->is_in_stack((address)this), "not on stack?"); \
|
||||
_thread->metadata_handles()->push((Metadata*)_value); \
|
||||
} else { \
|
||||
_thread = NULL; \
|
||||
} \
|
||||
} \
|
||||
name##Handle& name##Handle::operator=(const name##Handle &s) { \
|
||||
remove(); \
|
||||
_value = s._value; \
|
||||
if (_value != NULL) { \
|
||||
assert(_value->is_valid(), "obj is valid"); \
|
||||
if (s._thread != NULL) { \
|
||||
assert(s._thread == Thread::current(), "thread must be current");\
|
||||
_thread = s._thread; \
|
||||
} else { \
|
||||
_thread = Thread::current(); \
|
||||
} \
|
||||
assert (_thread->is_in_stack((address)this), "not on stack?"); \
|
||||
_thread->metadata_handles()->push((Metadata*)_value); \
|
||||
} else { \
|
||||
_thread = NULL; \
|
||||
} \
|
||||
return *this; \
|
||||
} \
|
||||
inline void name##Handle::remove() { \
|
||||
if (_value != NULL) { \
|
||||
int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
|
||||
assert(i!=-1, "not in metadata_handles list"); \
|
||||
_thread->metadata_handles()->remove_at(i); \
|
||||
} \
|
||||
} \
|
||||
name##Handle::~name##Handle () { remove(); } \
|
||||
|
||||
DEF_METADATA_HANDLE_FN_NOINLINE(method, Method)
|
||||
DEF_METADATA_HANDLE_FN_NOINLINE(constantPool, ConstantPool)
|
||||
|
||||
|
||||
static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
|
||||
oop* bottom = (oop*) chunk->bottom();
|
||||
oop* top = (oop*) chunk_top;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -69,48 +69,6 @@ inline name##Handle::name##Handle(Thread* thread, type* obj) : _value(obj), _thr
|
||||
_thread->metadata_handles()->push((Metadata*)obj); \
|
||||
} \
|
||||
} \
|
||||
inline name##Handle::name##Handle(const name##Handle &h) { \
|
||||
_value = h._value; \
|
||||
if (_value != NULL) { \
|
||||
assert(_value->is_valid(), "obj is valid"); \
|
||||
if (h._thread != NULL) { \
|
||||
assert(h._thread == Thread::current(), "thread must be current");\
|
||||
_thread = h._thread; \
|
||||
} else { \
|
||||
_thread = Thread::current(); \
|
||||
} \
|
||||
assert (_thread->is_in_stack((address)this), "not on stack?"); \
|
||||
_thread->metadata_handles()->push((Metadata*)_value); \
|
||||
} else { \
|
||||
_thread = NULL; \
|
||||
} \
|
||||
} \
|
||||
inline name##Handle& name##Handle::operator=(const name##Handle &s) { \
|
||||
remove(); \
|
||||
_value = s._value; \
|
||||
if (_value != NULL) { \
|
||||
assert(_value->is_valid(), "obj is valid"); \
|
||||
if (s._thread != NULL) { \
|
||||
assert(s._thread == Thread::current(), "thread must be current");\
|
||||
_thread = s._thread; \
|
||||
} else { \
|
||||
_thread = Thread::current(); \
|
||||
} \
|
||||
assert (_thread->is_in_stack((address)this), "not on stack?"); \
|
||||
_thread->metadata_handles()->push((Metadata*)_value); \
|
||||
} else { \
|
||||
_thread = NULL; \
|
||||
} \
|
||||
return *this; \
|
||||
} \
|
||||
inline void name##Handle::remove() { \
|
||||
if (_value != NULL) { \
|
||||
int i = _thread->metadata_handles()->find_from_end((Metadata*)_value); \
|
||||
assert(i!=-1, "not in metadata_handles list"); \
|
||||
_thread->metadata_handles()->remove_at(i); \
|
||||
} \
|
||||
} \
|
||||
inline name##Handle::~name##Handle () { remove(); } \
|
||||
|
||||
DEF_METADATA_HANDLE_FN(method, Method)
|
||||
DEF_METADATA_HANDLE_FN(constantPool, ConstantPool)
|
||||
|
@ -27,10 +27,13 @@
|
||||
* @bug 8142976
|
||||
* @library /testlibrary
|
||||
* @compile BadMap50.jasm
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
|
||||
* @run driver ClassInitializationTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class ClassInitializationTest {
|
||||
|
||||
|
@ -28,10 +28,12 @@
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||
* @run driver DefaultMethodsTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class DefaultMethodsTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -29,11 +29,12 @@
|
||||
* @ignore 8145587
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @build MonitorInflationTest
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||
* @run driver MonitorInflationTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class MonitorInflationTest {
|
||||
static void analyzeOutputOn(ProcessBuilder pb) throws Exception {
|
||||
|
@ -28,11 +28,13 @@
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||
* @run driver SafepointTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class SafepointTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -28,11 +28,13 @@
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
|
||||
* @run driver VMOperationTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
import java.lang.ref.WeakReference;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.ProcessTools;
|
||||
|
||||
public class VMOperationTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user