Skip to content

Commit e22762c

Browse files
committed
8314932: G1: Fix -Wconversion warnings for simple cases inside g1 folder
Reviewed-by: tschatzl, iwalulya
1 parent 762b652 commit e22762c

12 files changed

+14
-20
lines changed

src/hotspot/share/gc/g1/g1Analytics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ G1Analytics::G1Analytics(const G1Predictions* predictor) :
9494
_recent_prev_end_times_for_all_gcs_sec.add(os::elapsedTime());
9595
_prev_collection_pause_end_ms = os::elapsedTime() * 1000.0;
9696

97-
int index = MIN2(ParallelGCThreads - 1, 7u);
97+
uint index = MIN2(ParallelGCThreads - 1, 7u);
9898

9999
// Start with inverse of maximum STW cost.
100100
_concurrent_refine_rate_ms_seq.add(1/cost_per_logged_card_ms_defaults[0]);

src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ inline HeapWord* G1BlockOffsetTablePart::block_start_reaching_into_card(const vo
4646

4747
size_t index = _bot->index_for(addr);
4848

49-
uint offset = _bot->offset_array(index);
49+
u_char offset = _bot->offset_array(index);
5050
while (offset >= BOTConstants::card_size_in_words()) {
5151
// The excess of the offset from N_words indicates a power of Base
5252
// to go back by.

src/hotspot/share/gc/g1/g1CardTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void G1CardTable::g1_mark_as_young(const MemRegion& mr) {
3232
CardValue *const first = byte_for(mr.start());
3333
CardValue *const last = byte_after(mr.last());
3434

35-
memset_with_concurrent_readers(first, g1_young_gen, last - first);
35+
memset_with_concurrent_readers(first, g1_young_gen, pointer_delta(last, first, sizeof(CardValue)));
3636
}
3737

3838
#ifndef PRODUCT

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h,
390390
// _num_active_tasks set in set_non_marking_state()
391391
// _tasks set inside the constructor
392392

393-
_task_queues(new G1CMTaskQueueSet((int) _max_num_tasks)),
394-
_terminator((int) _max_num_tasks, _task_queues),
393+
_task_queues(new G1CMTaskQueueSet(_max_num_tasks)),
394+
_terminator(_max_num_tasks, _task_queues),
395395

396396
_first_overflow_barrier_sync(),
397397
_second_overflow_barrier_sync(),
@@ -540,8 +540,8 @@ void G1ConcurrentMark::set_concurrency(uint active_tasks) {
540540
// Need to update the three data structures below according to the
541541
// number of active threads for this phase.
542542
_terminator.reset_for_reuse(active_tasks);
543-
_first_overflow_barrier_sync.set_n_workers((int) active_tasks);
544-
_second_overflow_barrier_sync.set_n_workers((int) active_tasks);
543+
_first_overflow_barrier_sync.set_n_workers(active_tasks);
544+
_second_overflow_barrier_sync.set_n_workers(active_tasks);
545545
}
546546

547547
void G1ConcurrentMark::set_concurrency_and_phase(uint active_tasks, bool concurrent) {

src/hotspot/share/gc/g1/g1ConcurrentMark.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ class G1ConcurrentMark : public CHeapObj<mtGC> {
511511
// running.
512512
void abort_marking_threads();
513513

514-
void update_accum_task_vtime(int i, double vtime) {
514+
void update_accum_task_vtime(uint i, double vtime) {
515515
_accum_task_vtime[i] += vtime;
516516
}
517517

src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ size_t G1CMObjArrayProcessor::process_slice(HeapWord* slice) {
7474

7575
objArrayOop objArray = objArrayOop(cast_to_oop(start_address));
7676

77-
size_t already_scanned = slice - start_address;
77+
size_t already_scanned = pointer_delta(slice, start_address);
7878
size_t remaining = objArray->size() - already_scanned;
7979

8080
return process_array_slice(objArray, slice, remaining);

src/hotspot/share/gc/g1/g1EdenRegions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
class G1EdenRegions {
3434
private:
35-
int _length;
35+
uint _length;
3636
// Sum of used bytes from all retired eden regions.
3737
// I.e. updated when mutator regions are retired.
3838
volatile size_t _used_bytes;

src/hotspot/share/gc/g1/g1FreeIdSet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "gc/g1/g1FreeIdSet.hpp"
2727
#include "memory/allocation.inline.hpp"
2828
#include "runtime/atomic.hpp"
29+
#include "utilities/checkedCast.hpp"
2930
#include "utilities/debug.hpp"
3031
#include "utilities/globalDefinitions.hpp"
3132
#include "utilities/macros.hpp"
@@ -59,7 +60,7 @@ G1FreeIdSet::~G1FreeIdSet() {
5960
}
6061

6162
uint G1FreeIdSet::head_index(uintx head) const {
62-
return head & _head_index_mask;
63+
return checked_cast<uint>(head & _head_index_mask);
6364
}
6465

6566
uintx G1FreeIdSet::make_head(uint index, uintx old_head) const {

src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ size_t G1PageBasedVirtualSpace::uncommitted_size() const {
100100
return reserved_size() - committed_size();
101101
}
102102

103-
size_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const {
104-
return (addr - _low_boundary) / _page_size;
105-
}
106-
107103
bool G1PageBasedVirtualSpace::is_area_committed(size_t start_page, size_t size_in_pages) const {
108104
size_t end_page = start_page + size_in_pages;
109105
return _committed.find_first_clear_bit(start_page, end_page) >= end_page;

src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ class G1PageBasedVirtualSpace {
8484
// Uncommit the given memory range.
8585
void uncommit_internal(size_t start_page, size_t end_page);
8686

87-
// Returns the index of the page which contains the given address.
88-
size_t addr_to_page_index(char* addr) const;
89-
9087
// Is the given page index the last page?
9188
bool is_last_page(size_t index) const { return index == (_committed.size() - 1); }
9289
// Is the given page index the first after last page?

0 commit comments

Comments
 (0)