# HG changeset patch # User goetz # Date 1424092056 -3600 # Node ID d0d94abe737f32b9cc8722d0d45db46b28a9b0bf # Parent ce7613869df3b1c4b596d0d5d3cc189b21241d65 8073315: Enable gcc -Wtype-limits and fix upcoming issues. Summary: Relevant fixes in blockOffsetTable.cpp, os_linux.cpp, parCardTableModRefBS.cpp. diff --git a/make/linux/makefiles/gcc.make b/make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make +++ b/make/linux/makefiles/gcc.make @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 @@ -221,6 +221,9 @@ # conversions which might affect the values. Only enable it in earlier versions. ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" WARNING_FLAGS += -Wconversion + else + # This flag is only known since GCC 4.3. + WARNING_FLAGS += -Wtype-limits endif endif diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -3749,13 +3749,15 @@ // parts and try again. size_t top_overlap = requested_addr + (bytes + gap) - base[i]; - if (top_overlap >= 0 && top_overlap < bytes) { + if (requested_addr + (bytes + gap) >= base[i] && // Check underflow. + top_overlap < bytes) { unmap_memory(base[i], top_overlap); base[i] += top_overlap; size[i] = bytes - top_overlap; } else { size_t bottom_overlap = base[i] + bytes - requested_addr; - if (bottom_overlap >= 0 && bottom_overlap < bytes) { + if (base[i] + bytes >= requested_addr && // Check underflow. + bottom_overlap < bytes) { unmap_memory(requested_addr, bottom_overlap); size[i] = bytes - bottom_overlap; } else { @@ -6023,7 +6025,7 @@ } char *pid_pos = strstr(core_pattern, "%p"); - size_t written; + int written; if (core_pattern[0] == '/') { written = jio_snprintf(buffer, bufferSize, core_pattern); @@ -6045,8 +6047,8 @@ } } - if ((written >= 0) && (written < bufferSize) - && (pid_pos == NULL) && (core_pattern[0] != '|')) { + if ((written >= 0) && ((size_t)written < bufferSize) && + (pid_pos == NULL) && (core_pattern[0] != '|')) { int core_uses_pid_file = ::open("/proc/sys/kernel/core_uses_pid", O_RDONLY); if (core_uses_pid_file != -1) { diff --git a/src/share/vm/asm/codeBuffer.cpp b/src/share/vm/asm/codeBuffer.cpp --- a/src/share/vm/asm/codeBuffer.cpp +++ b/src/share/vm/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -926,9 +926,6 @@ void CodeBuffer::take_over_code_from(CodeBuffer* cb) { // Must already have disposed of the old blob somehow. assert(blob() == NULL, "must be empty"); -#ifdef ASSERT - -#endif // Take the new blob away from cb. set_blob(cb->blob()); // Take over all the section pointers. diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -1368,8 +1368,6 @@ ClassLoaderData* loader_data = k->class_loader_data(); Handle class_loader_h(THREAD, loader_data->class_loader()); - for (uintx it = 0; it < GCExpandToAllocateDelayMillis; it++){} - // for bootstrap and other parallel classloaders don't acquire lock, // use placeholder token // If a parallelCapable class loader calls define_instance_class instead of diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/src/share/vm/gc_implementation/g1/concurrentMark.cpp --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -2170,12 +2170,13 @@ g1h->secondary_free_list_add(&tmp_free_list); SecondaryFreeList_lock->notify_all(); } - +#ifndef PRODUCT if (G1StressConcRegionFreeing) { for (uintx i = 0; i < G1StressConcRegionFreeingDelayMillis; ++i) { os::sleep(Thread::current(), (jlong) 1, false); } } +#endif } } assert(tmp_free_list.is_empty(), "post-condition"); diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/src/share/vm/gc_implementation/g1/concurrentMark.hpp --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp @@ -853,7 +853,7 @@ // Returns the card bitmap for a given task or worker id. BitMap* count_card_bitmap_for(uint worker_id) { - assert(0 <= worker_id && worker_id < _max_worker_id, "oob"); + assert(worker_id < _max_worker_id, "oob"); assert(_count_card_bitmaps != NULL, "uninitialized"); BitMap* task_card_bm = &_count_card_bitmaps[worker_id]; assert(task_card_bm->size() == _card_bm.size(), "size mismatch"); @@ -863,7 +863,7 @@ // Returns the array containing the marked bytes for each region, // for the given worker or task id. size_t* count_marked_bytes_array_for(uint worker_id) { - assert(0 <= worker_id && worker_id < _max_worker_id, "oob"); + assert(worker_id < _max_worker_id, "oob"); assert(_count_marked_bytes != NULL, "uninitialized"); size_t* marked_bytes_array = _count_marked_bytes[worker_id]; assert(marked_bytes_array != NULL, "uninitialized"); diff --git a/src/share/vm/gc_implementation/g1/g1CardCounts.hpp b/src/share/vm/gc_implementation/g1/g1CardCounts.hpp --- a/src/share/vm/gc_implementation/g1/g1CardCounts.hpp +++ b/src/share/vm/gc_implementation/g1/g1CardCounts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -84,13 +84,13 @@ "_ct_bot: " PTR_FORMAT, p2i(card_ptr), p2i(_ct_bot))); size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte)); - assert(card_num >= 0 && card_num < _reserved_max_card_num, + assert(card_num < _reserved_max_card_num, err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr))); return card_num; } jbyte* card_num_2_ptr(size_t card_num) { - assert(card_num >= 0 && card_num < _reserved_max_card_num, + assert(card_num < _reserved_max_card_num, err_msg("card num out of range: "SIZE_FORMAT, card_num)); return (jbyte*) (_ct_bot + card_num); } diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -5420,7 +5420,7 @@ // limit is set using max_num_q() - which was set using ParallelGCThreads. // So this must be true - but assert just in case someone decides to // change the worker ids. - assert(0 <= worker_id && worker_id < limit, "sanity"); + assert(worker_id < limit, "sanity"); assert(!rp->discovery_is_atomic(), "check this code"); // Select discovered lists [i, i+stride, i+2*stride,...,limit) diff --git a/src/share/vm/gc_implementation/g1/heapRegion.cpp b/src/share/vm/gc_implementation/g1/heapRegion.cpp --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -325,9 +325,8 @@ void HeapRegion::note_self_forwarding_removal_end(bool during_initial_mark, bool during_conc_mark, size_t marked_bytes) { - assert(0 <= marked_bytes && marked_bytes <= used(), - err_msg("marked: "SIZE_FORMAT" used: "SIZE_FORMAT, - marked_bytes, used())); + assert(marked_bytes <= used(), + err_msg("marked: "SIZE_FORMAT" used: "SIZE_FORMAT, marked_bytes, used())); _prev_top_at_mark_start = top(); _prev_marked_bytes = marked_bytes; } diff --git a/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/src/share/vm/gc_implementation/g1/heapRegionManager.cpp --- a/src/share/vm/gc_implementation/g1/heapRegionManager.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -270,7 +270,7 @@ const uint n_regions = hrclaimer->n_regions(); for (uint count = 0; count < n_regions; count++) { const uint index = (start_index + count) % n_regions; - assert(0 <= index && index < n_regions, "sanity"); + assert(index < n_regions, "sanity"); // Skip over unavailable regions if (!is_available(index)) { continue; diff --git a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -541,7 +541,7 @@ PerRegionTable* OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const { - assert(0 <= ind && ind < _max_fine_entries, "Preconditions."); + assert(ind < _max_fine_entries, "Preconditions."); PerRegionTable* prt = _fine_grain_regions[ind]; while (prt != NULL && prt->hr() != hr) { prt = prt->collision_list_next(); diff --git a/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/src/share/vm/gc_implementation/g1/heapRegionSet.cpp --- a/src/share/vm/gc_implementation/g1/heapRegionSet.cpp +++ b/src/share/vm/gc_implementation/g1/heapRegionSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -56,8 +56,7 @@ // verification might fail and send us on a wild goose chase. check_mt_safety(); - guarantee(( is_empty() && length() == 0 && total_capacity_bytes() == 0) || - (!is_empty() && length() >= 0 && total_capacity_bytes() >= 0), + guarantee((is_empty() && length() == 0 && total_capacity_bytes() == 0) || !is_empty(), hrs_ext_msg(this, "invariant")); } diff --git a/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/src/share/vm/gc_implementation/g1/ptrQueue.cpp --- a/src/share/vm/gc_implementation/g1/ptrQueue.cpp +++ b/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -58,7 +58,7 @@ void PtrQueue::enqueue_known_active(void* ptr) { - assert(0 <= _index && _index <= _sz, "Invariant."); + assert(_index <= _sz, "Invariant."); assert(_index == 0 || _buf != NULL, "invariant"); while (_index == 0) { @@ -68,7 +68,7 @@ assert(_index > 0, "postcondition"); _index -= oopSize; _buf[byte_index_to_index((int)_index)] = ptr; - assert(0 <= _index && _index <= _sz, "Invariant."); + assert(_index <= _sz, "Invariant."); } void PtrQueue::locking_enqueue_completed_buffer(void** buf) { @@ -194,7 +194,7 @@ _buf = qset()->allocate_buffer(); _sz = qset()->buffer_size(); _index = _sz; - assert(0 <= _index && _index <= _sz, "Invariant."); + assert(_index <= _sz, "Invariant."); } bool PtrQueueSet::process_or_enqueue_complete_buffer(void** buf) { diff --git a/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp --- a/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp +++ b/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -195,8 +195,8 @@ // our closures depend on this property and do not protect against // double scans. - uintptr_t cur_chunk_index = addr_to_chunk_index(chunk_mr.start()); - cur_chunk_index = cur_chunk_index - lowest_non_clean_base_chunk_index; + uintptr_t start_chunk_index = addr_to_chunk_index(chunk_mr.start()); + uintptr_t cur_chunk_index = start_chunk_index - lowest_non_clean_base_chunk_index; NOISY(tty->print_cr("===========================================================================");) NOISY(tty->print_cr(" process_chunk_boundary: Called with [" PTR_FORMAT "," PTR_FORMAT ")", @@ -242,7 +242,8 @@ if (first_dirty_card != NULL) { NOISY(tty->print_cr(" LNC: Found a dirty card at " PTR_FORMAT " in current chunk", first_dirty_card);) - assert(0 <= cur_chunk_index && cur_chunk_index < lowest_non_clean_chunk_size, + assert(start_chunk_index >= lowest_non_clean_base_chunk_index && // Check underflow. + cur_chunk_index < lowest_non_clean_chunk_size, "Bounds error."); assert(lowest_non_clean[cur_chunk_index] == NULL, "Write exactly once : value should be stable hereafter for this round"); diff --git a/src/share/vm/gc_implementation/shared/gcUtil.hpp b/src/share/vm/gc_implementation/shared/gcUtil.hpp --- a/src/share/vm/gc_implementation/shared/gcUtil.hpp +++ b/src/share/vm/gc_implementation/shared/gcUtil.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -103,7 +103,7 @@ static inline float exp_avg(float avg, float sample, unsigned int weight) { - assert(0 <= weight && weight <= 100, "weight must be a percent"); + assert(weight <= 100, "weight must be a percent"); return (100.0F - weight) * avg / 100.0F + weight * sample / 100.0F; } static inline size_t exp_avg(size_t avg, size_t sample, diff --git a/src/share/vm/gc_implementation/shared/liveRange.hpp b/src/share/vm/gc_implementation/shared/liveRange.hpp --- a/src/share/vm/gc_implementation/shared/liveRange.hpp +++ b/src/share/vm/gc_implementation/shared/liveRange.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -42,7 +42,6 @@ MemRegion::set_end(e); } void set_word_size(size_t ws) { - assert(ws >= 0, "should be a non-zero range"); MemRegion::set_word_size(ws); } diff --git a/src/share/vm/gc_implementation/shared/mutableSpace.cpp b/src/share/vm/gc_implementation/shared/mutableSpace.cpp --- a/src/share/vm/gc_implementation/shared/mutableSpace.cpp +++ b/src/share/vm/gc_implementation/shared/mutableSpace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -36,8 +36,7 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) { - assert(MutableSpace::alignment() >= 0 && - MutableSpace::alignment() % os::vm_page_size() == 0, + assert(MutableSpace::alignment() % os::vm_page_size() == 0, "Space should be aligned"); _mangler = new MutableSpaceMangler(this); } diff --git a/src/share/vm/memory/allocation.cpp b/src/share/vm/memory/allocation.cpp --- a/src/share/vm/memory/allocation.cpp +++ b/src/share/vm/memory/allocation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -561,7 +561,6 @@ // Reallocate storage in Arena. void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size, AllocFailType alloc_failmode) { - assert(new_size >= 0, "bad size"); if (new_size == 0) return NULL; #ifdef ASSERT if (UseMallocOnly) { diff --git a/src/share/vm/memory/blockOffsetTable.cpp b/src/share/vm/memory/blockOffsetTable.cpp --- a/src/share/vm/memory/blockOffsetTable.cpp +++ b/src/share/vm/memory/blockOffsetTable.cpp @@ -792,6 +792,6 @@ } size_t BlockOffsetArrayContigSpace::last_active_index() const { - size_t result = _next_offset_index - 1; - return result >= 0 ? result : 0; + size_t next = _next_offset_index; + return next == 0 ? 0 : next - 1; } diff --git a/src/share/vm/memory/heap.cpp b/src/share/vm/memory/heap.cpp --- a/src/share/vm/memory/heap.cpp +++ b/src/share/vm/memory/heap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -52,7 +52,7 @@ void CodeHeap::mark_segmap_as_free(size_t beg, size_t end) { - assert(0 <= beg && beg < _number_of_committed_segments, "interval begin out of bounds"); + assert( beg < _number_of_committed_segments, "interval begin out of bounds"); assert(beg < end && end <= _number_of_committed_segments, "interval end out of bounds"); // setup _segmap pointers for faster indexing address p = (address)_segmap.low() + beg; @@ -63,7 +63,7 @@ void CodeHeap::mark_segmap_as_used(size_t beg, size_t end) { - assert(0 <= beg && beg < _number_of_committed_segments, "interval begin out of bounds"); + assert( beg < _number_of_committed_segments, "interval begin out of bounds"); assert(beg < end && end <= _number_of_committed_segments, "interval end out of bounds"); // setup _segmap pointers for faster indexing address p = (address)_segmap.low() + beg; diff --git a/src/share/vm/memory/referenceProcessor.cpp b/src/share/vm/memory/referenceProcessor.cpp --- a/src/share/vm/memory/referenceProcessor.cpp +++ b/src/share/vm/memory/referenceProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -987,7 +987,7 @@ id = next_id(); } } - assert(0 <= id && id < _max_num_q, "Id is out-of-bounds (call Freud?)"); + assert(id < _max_num_q, "Id is out-of-bounds (call Freud?)"); // Get the discovered queue to which we will add DiscoveredList* list = NULL; @@ -1345,7 +1345,7 @@ } const char* ReferenceProcessor::list_name(uint i) { - assert(i >= 0 && i <= _max_num_q * number_of_subclasses_of_ref(), + assert(i <= _max_num_q * number_of_subclasses_of_ref(), "Out of bounds index"); int j = i / _max_num_q; diff --git a/src/share/vm/opto/chaitin.cpp b/src/share/vm/opto/chaitin.cpp --- a/src/share/vm/opto/chaitin.cpp +++ b/src/share/vm/opto/chaitin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -602,7 +602,7 @@ // This frame must preserve the required fp alignment _framesize = round_to(_framesize, Matcher::stack_alignment_in_slots()); - assert( _framesize >= 0 && _framesize <= 1000000, "sanity check" ); + assert(_framesize <= 1000000, "sanity check"); #ifndef PRODUCT _total_framesize += _framesize; if ((int)_framesize > _max_framesize) { diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -3045,12 +3045,7 @@ // We may not have profiling here or it may not help us. If we have // a speculative type use it to perform an exact cast. ciKlass* spec_obj_type = obj_type->speculative_type(); - if (spec_obj_type != NULL || - (data != NULL && - // Counter has never been decremented (due to cast failure). - // ...This is a reasonable thing to expect. It is true of - // all casts inserted by javac to implement generic types. - data->as_CounterData()->count() >= 0)) { + if (spec_obj_type != NULL || (data != NULL)) { cast_obj = maybe_cast_profiled_receiver(not_null_obj, tk->klass(), spec_obj_type, safe_for_replace); if (cast_obj != NULL) { if (failure_control != NULL) // failure is now impossible diff --git a/src/share/vm/prims/jvmtiRedefineClasses.cpp b/src/share/vm/prims/jvmtiRedefineClasses.cpp --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -2905,7 +2905,7 @@ // same_frame { // u1 frame_type = SAME; /* 0-63 */ // } - if (frame_type >= 0 && frame_type <= 63) { + if (frame_type <= 63) { // nothing more to do for same_frame } diff --git a/src/share/vm/runtime/dtraceJSDT.hpp b/src/share/vm/runtime/dtraceJSDT.hpp --- a/src/share/vm/runtime/dtraceJSDT.hpp +++ b/src/share/vm/runtime/dtraceJSDT.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -83,12 +83,12 @@ int helper_handle() const { return _helper_handle; } nmethod* nmethod_at(size_t i) { - assert(i >= 0 && i < _count, "bad nmethod index"); + assert(i < _count, "bad nmethod index"); return _nmethods[i]; } void nmethod_at_put(size_t i, nmethod* nm) { - assert(i >= 0 && i < _count, "bad nmethod index"); + assert(i < _count, "bad nmethod index"); _nmethods[i] = nm; } }; diff --git a/src/share/vm/utilities/bitMap.cpp b/src/share/vm/utilities/bitMap.cpp --- a/src/share/vm/utilities/bitMap.cpp +++ b/src/share/vm/utilities/bitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -33,7 +33,6 @@ _map(map), _size(size_in_bits), _map_allocator(false) { assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); - assert(size_in_bits >= 0, "just checking"); } @@ -45,7 +44,6 @@ } void BitMap::resize(idx_t size_in_bits, bool in_resource_area) { - assert(size_in_bits >= 0, "just checking"); idx_t old_size_in_words = size_in_words(); bm_word_t* old_map = map(); diff --git a/src/share/vm/utilities/workgroup.cpp b/src/share/vm/utilities/workgroup.cpp --- a/src/share/vm/utilities/workgroup.cpp +++ b/src/share/vm/utilities/workgroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -124,7 +124,7 @@ // Array index bounds checking. GangWorker* result = NULL; assert(gang_workers() != NULL, "No workers for indexing"); - assert(((i >= 0) && (i < total_workers())), "Worker index out of bounds"); + assert(i < total_workers(), "Worker index out of bounds"); result = _gang_workers[i]; assert(result != NULL, "Indexing to null worker"); return result; @@ -462,7 +462,7 @@ } bool SubTasksDone::is_task_claimed(uint t) { - assert(0 <= t && t < _n_tasks, "bad task id."); + assert(t < _n_tasks, "bad task id."); uint old = _tasks[t]; if (old == 0) { old = Atomic::cmpxchg(1, &_tasks[t], 0); diff --git a/src/share/vm/utilities/yieldingWorkgroup.cpp b/src/share/vm/utilities/yieldingWorkgroup.cpp --- a/src/share/vm/utilities/yieldingWorkgroup.cpp +++ b/src/share/vm/utilities/yieldingWorkgroup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -120,7 +120,6 @@ _sequence_number++; uint requested_size = new_task->requested_size(); - assert(requested_size >= 0, "Should be non-negative"); if (requested_size != 0) { _active_workers = MIN2(requested_size, total_workers()); } else {