8003310: Enable -Wunused-function when compiling with gcc

Thu, 04 Apr 2013 10:01:26 -0700

author
mikael
date
Thu, 04 Apr 2013 10:01:26 -0700
changeset 4889
cc32ccaaf47f
parent 4888
17bf4d428955
child 4890
4c8bb5e4f68f
child 4891
8be1318fbe77
child 4893
4b7cf00ccb08

8003310: Enable -Wunused-function when compiling with gcc
Summary: Add the -Wunused-function flag and remove a number of unused functions.
Reviewed-by: dholmes, coleenp, kvn

make/linux/makefiles/gcc.make file | annotate | diff | comparison | revisions
src/cpu/x86/vm/assembler_x86.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/methodHandles_x86.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/x86_64.ad file | annotate | diff | comparison | revisions
src/os/bsd/vm/os_bsd.cpp file | annotate | diff | comparison | revisions
src/os/linux/vm/os_linux.cpp file | annotate | diff | comparison | revisions
src/os/solaris/vm/os_solaris.cpp file | annotate | diff | comparison | revisions
src/share/vm/c1/c1_LIRGenerator.cpp file | annotate | diff | comparison | revisions
src/share/vm/compiler/compileLog.cpp file | annotate | diff | comparison | revisions
src/share/vm/compiler/compilerOracle.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/ptrQueue.cpp file | annotate | diff | comparison | revisions
src/share/vm/interpreter/interpreterRuntime.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/heap.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/universe.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/constantPool.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/block.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/compile.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/connode.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/subnode.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/jni.cpp file | annotate | diff | comparison | revisions
src/share/vm/prims/jniCheck.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/safepoint.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/synchronizer.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/synchronizer.hpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/debug.cpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/globalDefinitions.cpp file | annotate | diff | comparison | revisions
src/share/vm/utilities/globalDefinitions.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/make/linux/makefiles/gcc.make	Wed Apr 03 16:43:09 2013 -0700
     1.2 +++ b/make/linux/makefiles/gcc.make	Thu Apr 04 10:01:26 2013 -0700
     1.3 @@ -126,14 +126,12 @@
     1.4  # Compiler warnings are treated as errors
     1.5  WARNINGS_ARE_ERRORS = -Werror
     1.6  
     1.7 -# Except for a few acceptable ones
     1.8 +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function
     1.9 +
    1.10  # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
    1.11 -# conversions which might affect the values. To avoid that, we need to turn
    1.12 -# it off explicitly. 
    1.13 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
    1.14 -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
    1.15 -else
    1.16 -WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef
    1.17 +# conversions which might affect the values. Only enable it in earlier versions.
    1.18 +ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
    1.19 +WARNING_FLAGS += -Wconversion
    1.20  endif
    1.21  
    1.22  CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
     2.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Wed Apr 03 16:43:09 2013 -0700
     2.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Thu Apr 04 10:01:26 2013 -0700
     2.3 @@ -214,14 +214,6 @@
     2.4    return enc;
     2.5  }
     2.6  
     2.7 -static int encode(XMMRegister r) {
     2.8 -  int enc = r->encoding();
     2.9 -  if (enc >= 8) {
    2.10 -    enc -= 8;
    2.11 -  }
    2.12 -  return enc;
    2.13 -}
    2.14 -
    2.15  void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) {
    2.16    assert(dst->has_byte_register(), "must have byte register");
    2.17    assert(isByte(op1) && isByte(op2), "wrong opcode");
     3.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp	Wed Apr 03 16:43:09 2013 -0700
     3.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Apr 04 10:01:26 2013 -0700
     3.3 @@ -41,11 +41,6 @@
     3.4  
     3.5  #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
     3.6  
     3.7 -// Workaround for C++ overloading nastiness on '0' for RegisterOrConstant.
     3.8 -static RegisterOrConstant constant(int value) {
     3.9 -  return RegisterOrConstant(value);
    3.10 -}
    3.11 -
    3.12  void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) {
    3.13    if (VerifyMethodHandles)
    3.14      verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),
     4.1 --- a/src/cpu/x86/vm/x86_64.ad	Wed Apr 03 16:43:09 2013 -0700
     4.2 +++ b/src/cpu/x86/vm/x86_64.ad	Thu Apr 04 10:01:26 2013 -0700
     4.3 @@ -1669,17 +1669,6 @@
     4.4    return PTR_RBP_REG_mask();
     4.5  }
     4.6  
     4.7 -static Address build_address(int b, int i, int s, int d) {
     4.8 -  Register index = as_Register(i);
     4.9 -  Address::ScaleFactor scale = (Address::ScaleFactor)s;
    4.10 -  if (index == rsp) {
    4.11 -    index = noreg;
    4.12 -    scale = Address::no_scale;
    4.13 -  }
    4.14 -  Address addr(as_Register(b), index, scale, d);
    4.15 -  return addr;
    4.16 -}
    4.17 -
    4.18  %}
    4.19  
    4.20  //----------ENCODING BLOCK-----------------------------------------------------
     5.1 --- a/src/os/bsd/vm/os_bsd.cpp	Wed Apr 03 16:43:09 2013 -0700
     5.2 +++ b/src/os/bsd/vm/os_bsd.cpp	Thu Apr 04 10:01:26 2013 -0700
     5.3 @@ -152,7 +152,6 @@
     5.4  // utility functions
     5.5  
     5.6  static int SR_initialize();
     5.7 -static int SR_finalize();
     5.8  
     5.9  julong os::available_memory() {
    5.10    return Bsd::available_memory();
    5.11 @@ -2783,10 +2782,6 @@
    5.12    return 0;
    5.13  }
    5.14  
    5.15 -static int SR_finalize() {
    5.16 -  return 0;
    5.17 -}
    5.18 -
    5.19  
    5.20  // returns true on success and false on error - really an error is fatal
    5.21  // but this seems the normal response to library errors
    5.22 @@ -3595,16 +3590,6 @@
    5.23  ////////////////////////////////////////////////////////////////////////////////
    5.24  // debug support
    5.25  
    5.26 -static address same_page(address x, address y) {
    5.27 -  int page_bits = -os::vm_page_size();
    5.28 -  if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
    5.29 -    return x;
    5.30 -  else if (x > y)
    5.31 -    return (address)(intptr_t(y) | ~page_bits) + 1;
    5.32 -  else
    5.33 -    return (address)(intptr_t(y) & page_bits);
    5.34 -}
    5.35 -
    5.36  bool os::find(address addr, outputStream* st) {
    5.37    Dl_info dlinfo;
    5.38    memset(&dlinfo, 0, sizeof(dlinfo));
    5.39 @@ -3628,8 +3613,8 @@
    5.40  
    5.41      if (Verbose) {
    5.42        // decode some bytes around the PC
    5.43 -      address begin = same_page(addr-40, addr);
    5.44 -      address end   = same_page(addr+40, addr);
    5.45 +      address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
    5.46 +      address end   = clamp_address_in_page(addr+40, addr, os::vm_page_size());
    5.47        address       lowest = (address) dlinfo.dli_sname;
    5.48        if (!lowest)  lowest = (address) dlinfo.dli_fbase;
    5.49        if (begin < lowest)  begin = lowest;
     6.1 --- a/src/os/linux/vm/os_linux.cpp	Wed Apr 03 16:43:09 2013 -0700
     6.2 +++ b/src/os/linux/vm/os_linux.cpp	Thu Apr 04 10:01:26 2013 -0700
     6.3 @@ -176,7 +176,6 @@
     6.4  // utility functions
     6.5  
     6.6  static int SR_initialize();
     6.7 -static int SR_finalize();
     6.8  
     6.9  julong os::available_memory() {
    6.10    return Linux::available_memory();
    6.11 @@ -3672,10 +3671,6 @@
    6.12    return 0;
    6.13  }
    6.14  
    6.15 -static int SR_finalize() {
    6.16 -  return 0;
    6.17 -}
    6.18 -
    6.19  
    6.20  // returns true on success and false on error - really an error is fatal
    6.21  // but this seems the normal response to library errors
    6.22 @@ -4517,16 +4512,6 @@
    6.23  ////////////////////////////////////////////////////////////////////////////////
    6.24  // debug support
    6.25  
    6.26 -static address same_page(address x, address y) {
    6.27 -  int page_bits = -os::vm_page_size();
    6.28 -  if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
    6.29 -    return x;
    6.30 -  else if (x > y)
    6.31 -    return (address)(intptr_t(y) | ~page_bits) + 1;
    6.32 -  else
    6.33 -    return (address)(intptr_t(y) & page_bits);
    6.34 -}
    6.35 -
    6.36  bool os::find(address addr, outputStream* st) {
    6.37    Dl_info dlinfo;
    6.38    memset(&dlinfo, 0, sizeof(dlinfo));
    6.39 @@ -4550,8 +4535,8 @@
    6.40  
    6.41      if (Verbose) {
    6.42        // decode some bytes around the PC
    6.43 -      address begin = same_page(addr-40, addr);
    6.44 -      address end   = same_page(addr+40, addr);
    6.45 +      address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
    6.46 +      address end   = clamp_address_in_page(addr+40, addr, os::vm_page_size());
    6.47        address       lowest = (address) dlinfo.dli_sname;
    6.48        if (!lowest)  lowest = (address) dlinfo.dli_fbase;
    6.49        if (begin < lowest)  begin = lowest;
     7.1 --- a/src/os/solaris/vm/os_solaris.cpp	Wed Apr 03 16:43:09 2013 -0700
     7.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Thu Apr 04 10:01:26 2013 -0700
     7.3 @@ -5808,16 +5808,6 @@
     7.4  
     7.5  //---------------------------------------------------------------------------------
     7.6  
     7.7 -static address same_page(address x, address y) {
     7.8 -  intptr_t page_bits = -os::vm_page_size();
     7.9 -  if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
    7.10 -    return x;
    7.11 -  else if (x > y)
    7.12 -    return (address)(intptr_t(y) | ~page_bits) + 1;
    7.13 -  else
    7.14 -    return (address)(intptr_t(y) & page_bits);
    7.15 -}
    7.16 -
    7.17  bool os::find(address addr, outputStream* st) {
    7.18    Dl_info dlinfo;
    7.19    memset(&dlinfo, 0, sizeof(dlinfo));
    7.20 @@ -5843,8 +5833,8 @@
    7.21  
    7.22      if (Verbose) {
    7.23        // decode some bytes around the PC
    7.24 -      address begin = same_page(addr-40, addr);
    7.25 -      address end   = same_page(addr+40, addr);
    7.26 +      address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
    7.27 +      address end   = clamp_address_in_page(addr+40, addr, os::vm_page_size());
    7.28        address       lowest = (address) dlinfo.dli_sname;
    7.29        if (!lowest)  lowest = (address) dlinfo.dli_fbase;
    7.30        if (begin < lowest)  begin = lowest;
     8.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 03 16:43:09 2013 -0700
     8.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Apr 04 10:01:26 2013 -0700
     8.3 @@ -707,25 +707,6 @@
     8.4    }
     8.5  }
     8.6  
     8.7 -static Value maxvalue(IfOp* ifop) {
     8.8 -  switch (ifop->cond()) {
     8.9 -    case If::eql: return NULL;
    8.10 -    case If::neq: return NULL;
    8.11 -    case If::lss: // x <  y ? x : y
    8.12 -    case If::leq: // x <= y ? x : y
    8.13 -      if (ifop->x() == ifop->tval() &&
    8.14 -          ifop->y() == ifop->fval()) return ifop->y();
    8.15 -      return NULL;
    8.16 -
    8.17 -    case If::gtr: // x >  y ? y : x
    8.18 -    case If::geq: // x >= y ? y : x
    8.19 -      if (ifop->x() == ifop->tval() &&
    8.20 -          ifop->y() == ifop->fval()) return ifop->y();
    8.21 -      return NULL;
    8.22 -
    8.23 -  }
    8.24 -}
    8.25 -
    8.26  static ciType* phi_declared_type(Phi* phi) {
    8.27    ciType* t = phi->operand_at(0)->declared_type();
    8.28    if (t == NULL) {
     9.1 --- a/src/share/vm/compiler/compileLog.cpp	Wed Apr 03 16:43:09 2013 -0700
     9.2 +++ b/src/share/vm/compiler/compileLog.cpp	Thu Apr 04 10:01:26 2013 -0700
     9.3 @@ -60,28 +60,6 @@
     9.4  }
     9.5  
     9.6  
     9.7 -// Advance kind up to a null or space, return this tail.
     9.8 -// Make sure kind is null-terminated, not space-terminated.
     9.9 -// Use the buffer if necessary.
    9.10 -static const char* split_attrs(const char* &kind, char* buffer) {
    9.11 -  const char* attrs = strchr(kind, ' ');
    9.12 -  // Tease apart the first word from the rest:
    9.13 -  if (attrs == NULL) {
    9.14 -    return "";  // no attrs, no split
    9.15 -  } else if (kind == buffer) {
    9.16 -    ((char*) attrs)[-1] = 0;
    9.17 -    return attrs;
    9.18 -  } else {
    9.19 -    // park it in the buffer, so we can put a null on the end
    9.20 -    assert(!(kind >= buffer && kind < buffer+100), "not obviously in buffer");
    9.21 -    int klen = attrs - kind;
    9.22 -    strncpy(buffer, kind, klen);
    9.23 -    buffer[klen] = 0;
    9.24 -    kind = buffer;  // return by reference
    9.25 -    return attrs;
    9.26 -  }
    9.27 -}
    9.28 -
    9.29  // see_tag, pop_tag:  Override the default do-nothing methods on xmlStream.
    9.30  // These methods provide a hook for managing the the extra context markup.
    9.31  void CompileLog::see_tag(const char* tag, bool push) {
    10.1 --- a/src/share/vm/compiler/compilerOracle.cpp	Wed Apr 03 16:43:09 2013 -0700
    10.2 +++ b/src/share/vm/compiler/compilerOracle.cpp	Thu Apr 04 10:01:26 2013 -0700
    10.3 @@ -237,13 +237,6 @@
    10.4    "help"
    10.5  };
    10.6  
    10.7 -static const char * command_name(OracleCommand command) {
    10.8 -  if (command < OracleFirstCommand || command >= OracleCommandCount) {
    10.9 -    return "unknown command";
   10.10 -  }
   10.11 -  return command_names[command];
   10.12 -}
   10.13 -
   10.14  class MethodMatcher;
   10.15  static MethodMatcher* lists[OracleCommandCount] = { 0, };
   10.16  
    11.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Apr 03 16:43:09 2013 -0700
    11.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Thu Apr 04 10:01:26 2013 -0700
    11.3 @@ -1359,18 +1359,6 @@
    11.4  #endif // PRODUCT
    11.5  }
    11.6  
    11.7 -#ifndef PRODUCT
    11.8 -// for debugging, bit of a hack...
    11.9 -static char*
   11.10 -region_num_to_mbs(int length) {
   11.11 -  static char buffer[64];
   11.12 -  double bytes = (double) (length * HeapRegion::GrainBytes);
   11.13 -  double mbs = bytes / (double) (1024 * 1024);
   11.14 -  sprintf(buffer, "%7.2lfMB", mbs);
   11.15 -  return buffer;
   11.16 -}
   11.17 -#endif // PRODUCT
   11.18 -
   11.19  uint G1CollectorPolicy::max_regions(int purpose) {
   11.20    switch (purpose) {
   11.21      case GCAllocForSurvived:
    12.1 --- a/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Wed Apr 03 16:43:09 2013 -0700
    12.2 +++ b/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Thu Apr 04 10:01:26 2013 -0700
    12.3 @@ -53,15 +53,6 @@
    12.4  }
    12.5  
    12.6  
    12.7 -static int byte_index_to_index(int ind) {
    12.8 -  assert((ind % oopSize) == 0, "Invariant.");
    12.9 -  return ind / oopSize;
   12.10 -}
   12.11 -
   12.12 -static int index_to_byte_index(int byte_ind) {
   12.13 -  return byte_ind * oopSize;
   12.14 -}
   12.15 -
   12.16  void PtrQueue::enqueue_known_active(void* ptr) {
   12.17    assert(0 <= _index && _index <= _sz, "Invariant.");
   12.18    assert(_index == 0 || _buf != NULL, "invariant");
    13.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Apr 03 16:43:09 2013 -0700
    13.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Apr 04 10:01:26 2013 -0700
    13.3 @@ -557,11 +557,6 @@
    13.4  // be shared by method invocation and synchronized blocks.
    13.5  //%note synchronization_3
    13.6  
    13.7 -static void trace_locking(Handle& h_locking_obj, bool is_locking) {
    13.8 -  ObjectSynchronizer::trace_locking(h_locking_obj, false, true, is_locking);
    13.9 -}
   13.10 -
   13.11 -
   13.12  //%note monitor_1
   13.13  IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem))
   13.14  #ifdef ASSERT
    14.1 --- a/src/share/vm/memory/heap.cpp	Wed Apr 03 16:43:09 2013 -0700
    14.2 +++ b/src/share/vm/memory/heap.cpp	Thu Apr 04 10:01:26 2013 -0700
    14.3 @@ -79,13 +79,6 @@
    14.4  }
    14.5  
    14.6  
    14.7 -static size_t align_to_allocation_size(size_t size) {
    14.8 -  const size_t alignment = (size_t)os::vm_allocation_granularity();
    14.9 -  assert(is_power_of_2(alignment), "no kidding ???");
   14.10 -  return (size + alignment - 1) & ~(alignment - 1);
   14.11 -}
   14.12 -
   14.13 -
   14.14  void CodeHeap::on_code_mapping(char* base, size_t size) {
   14.15  #ifdef LINUX
   14.16    extern void linux_wrap_code(char* base, size_t size);
    15.1 --- a/src/share/vm/memory/universe.cpp	Wed Apr 03 16:43:09 2013 -0700
    15.2 +++ b/src/share/vm/memory/universe.cpp	Thu Apr 04 10:01:26 2013 -0700
    15.3 @@ -1335,6 +1335,8 @@
    15.4  static uintptr_t _verify_klass_data[2] = {0, (uintptr_t)-1};
    15.5  
    15.6  
    15.7 +#ifndef PRODUCT
    15.8 +
    15.9  static void calculate_verify_data(uintptr_t verify_data[2],
   15.10                                    HeapWord* low_boundary,
   15.11                                    HeapWord* high_boundary) {
   15.12 @@ -1369,9 +1371,7 @@
   15.13    verify_data[1] = bits;
   15.14  }
   15.15  
   15.16 -
   15.17  // Oop verification (see MacroAssembler::verify_oop)
   15.18 -#ifndef PRODUCT
   15.19  
   15.20  uintptr_t Universe::verify_oop_mask() {
   15.21    MemRegion m = heap()->reserved_region();
    16.1 --- a/src/share/vm/oops/constantPool.cpp	Wed Apr 03 16:43:09 2013 -0700
    16.2 +++ b/src/share/vm/oops/constantPool.cpp	Thu Apr 04 10:01:26 2013 -0700
    16.3 @@ -1378,12 +1378,13 @@
    16.4  
    16.5  // JVMTI GetConstantPool support
    16.6  
    16.7 -// For temporary use until code is stable.
    16.8 -#define DBG(code)
    16.9 +// For debugging of constant pool
   16.10 +const bool debug_cpool = false;
   16.11  
   16.12 -static const char* WARN_MSG = "Must not be such entry!";
   16.13 +#define DBG(code) do { if (debug_cpool) { (code); } } while(0)
   16.14  
   16.15  static void print_cpool_bytes(jint cnt, u1 *bytes) {
   16.16 +  const char* WARN_MSG = "Must not be such entry!";
   16.17    jint size = 0;
   16.18    u2   idx1, idx2;
   16.19  
   16.20 @@ -1669,8 +1670,7 @@
   16.21          idx1 = tbl->symbol_to_value(sym);
   16.22          assert(idx1 != 0, "Have not found a hashtable entry");
   16.23          Bytes::put_Java_u2((address) (bytes+1), idx1);
   16.24 -        DBG(char *str = sym->as_utf8());
   16.25 -        DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str));
   16.26 +        DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, sym->as_utf8()));
   16.27          break;
   16.28        }
   16.29        case JVM_CONSTANT_Fieldref:
   16.30 @@ -1745,6 +1745,8 @@
   16.31    return (int)(bytes - start_bytes);
   16.32  } /* end copy_cpool_bytes */
   16.33  
   16.34 +#undef DBG
   16.35 +
   16.36  
   16.37  void ConstantPool::set_on_stack(const bool value) {
   16.38    if (value) {
    17.1 --- a/src/share/vm/opto/block.cpp	Wed Apr 03 16:43:09 2013 -0700
    17.2 +++ b/src/share/vm/opto/block.cpp	Thu Apr 04 10:01:26 2013 -0700
    17.3 @@ -1028,26 +1028,6 @@
    17.4  }
    17.5  
    17.6  #ifndef PRODUCT
    17.7 -static void edge_dump(GrowableArray<CFGEdge *> *edges) {
    17.8 -  tty->print_cr("---- Edges ----");
    17.9 -  for (int i = 0; i < edges->length(); i++) {
   17.10 -    CFGEdge *e = edges->at(i);
   17.11 -    if (e != NULL) {
   17.12 -      edges->at(i)->dump();
   17.13 -    }
   17.14 -  }
   17.15 -}
   17.16 -
   17.17 -static void trace_dump(Trace *traces[], int count) {
   17.18 -  tty->print_cr("---- Traces ----");
   17.19 -  for (int i = 0; i < count; i++) {
   17.20 -    Trace *tr = traces[i];
   17.21 -    if (tr != NULL) {
   17.22 -      tr->dump();
   17.23 -    }
   17.24 -  }
   17.25 -}
   17.26 -
   17.27  void Trace::dump( ) const {
   17.28    tty->print_cr("Trace (freq %f)", first_block()->_freq);
   17.29    for (Block *b = first_block(); b != NULL; b = next(b)) {
    18.1 --- a/src/share/vm/opto/compile.cpp	Wed Apr 03 16:43:09 2013 -0700
    18.2 +++ b/src/share/vm/opto/compile.cpp	Thu Apr 04 10:01:26 2013 -0700
    18.3 @@ -2326,12 +2326,14 @@
    18.4    int  get_inner_loop_count() const { return _inner_loop_count; }
    18.5  };
    18.6  
    18.7 +#ifdef ASSERT
    18.8  static bool oop_offset_is_sane(const TypeInstPtr* tp) {
    18.9    ciInstanceKlass *k = tp->klass()->as_instance_klass();
   18.10    // Make sure the offset goes inside the instance layout.
   18.11    return k->contains_field_offset(tp->offset());
   18.12    // Note that OffsetBot and OffsetTop are very negative.
   18.13  }
   18.14 +#endif
   18.15  
   18.16  // Eliminate trivially redundant StoreCMs and accumulate their
   18.17  // precedence edges.
    19.1 --- a/src/share/vm/opto/connode.cpp	Wed Apr 03 16:43:09 2013 -0700
    19.2 +++ b/src/share/vm/opto/connode.cpp	Thu Apr 04 10:01:26 2013 -0700
    19.3 @@ -465,29 +465,6 @@
    19.4    return (phase->type(in(1)) == phase->type(this)) ? in(1) : this;
    19.5  }
    19.6  
    19.7 -// Determine whether "n" is a node which can cause an alias of one of its inputs.  Node types
    19.8 -// which can create aliases are: CheckCastPP, Phi, and any store (if there is also a load from
    19.9 -// the location.)
   19.10 -// Note:  this checks for aliases created in this compilation, not ones which may
   19.11 -//        be potentially created at call sites.
   19.12 -static bool can_cause_alias(Node *n, PhaseTransform *phase) {
   19.13 -  bool possible_alias = false;
   19.14 -
   19.15 -  if (n->is_Store()) {
   19.16 -    possible_alias = !n->as_Store()->value_never_loaded(phase);
   19.17 -  } else {
   19.18 -    int opc = n->Opcode();
   19.19 -    possible_alias = n->is_Phi() ||
   19.20 -        opc == Op_CheckCastPP ||
   19.21 -        opc == Op_StorePConditional ||
   19.22 -        opc == Op_CompareAndSwapP ||
   19.23 -        opc == Op_CompareAndSwapN ||
   19.24 -        opc == Op_GetAndSetP ||
   19.25 -        opc == Op_GetAndSetN;
   19.26 -  }
   19.27 -  return possible_alias;
   19.28 -}
   19.29 -
   19.30  //------------------------------Value------------------------------------------
   19.31  // Take 'join' of input and cast-up type, unless working with an Interface
   19.32  const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const {
    20.1 --- a/src/share/vm/opto/subnode.cpp	Wed Apr 03 16:43:09 2013 -0700
    20.2 +++ b/src/share/vm/opto/subnode.cpp	Thu Apr 04 10:01:26 2013 -0700
    20.3 @@ -1078,16 +1078,6 @@
    20.4    return (_test._test == b->_test._test);
    20.5  }
    20.6  
    20.7 -//------------------------------clone_cmp--------------------------------------
    20.8 -// Clone a compare/bool tree
    20.9 -static Node *clone_cmp( Node *cmp, Node *cmp1, Node *cmp2, PhaseGVN *gvn, BoolTest::mask test ) {
   20.10 -  Node *ncmp = cmp->clone();
   20.11 -  ncmp->set_req(1,cmp1);
   20.12 -  ncmp->set_req(2,cmp2);
   20.13 -  ncmp = gvn->transform( ncmp );
   20.14 -  return new (gvn->C) BoolNode( ncmp, test );
   20.15 -}
   20.16 -
   20.17  //-------------------------------make_predicate--------------------------------
   20.18  Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) {
   20.19    if (test_value->is_Con())   return test_value;
    21.1 --- a/src/share/vm/prims/jni.cpp	Wed Apr 03 16:43:09 2013 -0700
    21.2 +++ b/src/share/vm/prims/jni.cpp	Thu Apr 04 10:01:26 2013 -0700
    21.3 @@ -1289,32 +1289,6 @@
    21.4    JNI_NONVIRTUAL
    21.5  };
    21.6  
    21.7 -static methodHandle jni_resolve_interface_call(Handle recv, methodHandle method, TRAPS) {
    21.8 -  assert(!method.is_null() , "method should not be null");
    21.9 -
   21.10 -  KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
   21.11 -  if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
   21.12 -  KlassHandle spec_klass (THREAD, method->method_holder());
   21.13 -  Symbol*  name  = method->name();
   21.14 -  Symbol*  signature  = method->signature();
   21.15 -  CallInfo info;
   21.16 -  LinkResolver::resolve_interface_call(info, recv, recv_klass,  spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
   21.17 -  return info.selected_method();
   21.18 -}
   21.19 -
   21.20 -static methodHandle jni_resolve_virtual_call(Handle recv, methodHandle method, TRAPS) {
   21.21 -  assert(!method.is_null() , "method should not be null");
   21.22 -
   21.23 -  KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
   21.24 -  if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
   21.25 -  KlassHandle spec_klass (THREAD, method->method_holder());
   21.26 -  Symbol*  name  = method->name();
   21.27 -  Symbol*  signature  = method->signature();
   21.28 -  CallInfo info;
   21.29 -  LinkResolver::resolve_virtual_call(info, recv, recv_klass,  spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
   21.30 -  return info.selected_method();
   21.31 -}
   21.32 -
   21.33  
   21.34  
   21.35  static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
   21.36 @@ -5053,6 +5027,7 @@
   21.37  void execute_internal_vm_tests() {
   21.38    if (ExecuteInternalVMTests) {
   21.39      tty->print_cr("Running internal VM tests");
   21.40 +    run_unit_test(GlobalDefinitions::test_globals());
   21.41      run_unit_test(arrayOopDesc::test_max_array_length());
   21.42      run_unit_test(CollectedHeap::test_is_in());
   21.43      run_unit_test(QuickSort::test_quick_sort());
    22.1 --- a/src/share/vm/prims/jniCheck.hpp	Wed Apr 03 16:43:09 2013 -0700
    22.2 +++ b/src/share/vm/prims/jniCheck.hpp	Thu Apr 04 10:01:26 2013 -0700
    22.3 @@ -33,7 +33,7 @@
    22.4    // within IN_VM macro), one to be called when in NATIVE state.
    22.5  
    22.6    // When in VM state:
    22.7 -  static void ReportJNIFatalError(JavaThread* thr, const char *msg) {
    22.8 +  static inline void ReportJNIFatalError(JavaThread* thr, const char *msg) {
    22.9      tty->print_cr("FATAL ERROR in native method: %s", msg);
   22.10      thr->print_stack();
   22.11      os::abort(true);
    23.1 --- a/src/share/vm/runtime/arguments.cpp	Wed Apr 03 16:43:09 2013 -0700
    23.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Apr 04 10:01:26 2013 -0700
    23.3 @@ -1745,11 +1745,15 @@
    23.4    return false;
    23.5  }
    23.6  
    23.7 +#if !INCLUDE_ALL_GCS
    23.8 +#ifdef ASSERT
    23.9  static bool verify_serial_gc_flags() {
   23.10    return (UseSerialGC &&
   23.11          !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
   23.12            UseParallelGC || UseParallelOldGC));
   23.13  }
   23.14 +#endif // ASSERT
   23.15 +#endif // INCLUDE_ALL_GCS
   23.16  
   23.17  // check if do gclog rotation
   23.18  // +UseGCLogFileRotation is a must,
   23.19 @@ -3085,6 +3089,7 @@
   23.20    }                                                                   \
   23.21  } while(0)
   23.22  
   23.23 +#if !INCLUDE_ALL_GCS
   23.24  static void force_serial_gc() {
   23.25    FLAG_SET_DEFAULT(UseSerialGC, true);
   23.26    FLAG_SET_DEFAULT(CMSIncrementalMode, false);  // special CMS suboption
   23.27 @@ -3094,6 +3099,7 @@
   23.28    UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC);
   23.29    UNSUPPORTED_GC_OPTION(UseParNewGC);
   23.30  }
   23.31 +#endif // INCLUDE_ALL_GCS
   23.32  
   23.33  // Parse entry point called from JNI_CreateJavaVM
   23.34  
    24.1 --- a/src/share/vm/runtime/safepoint.cpp	Wed Apr 03 16:43:09 2013 -0700
    24.2 +++ b/src/share/vm/runtime/safepoint.cpp	Thu Apr 04 10:01:26 2013 -0700
    24.3 @@ -735,6 +735,9 @@
    24.4  // Exception handlers
    24.5  
    24.6  #ifndef PRODUCT
    24.7 +
    24.8 +#ifdef SPARC
    24.9 +
   24.10  #ifdef _LP64
   24.11  #define PTR_PAD ""
   24.12  #else
   24.13 @@ -755,7 +758,6 @@
   24.14                  newptr, is_oop?"oop":"   ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":"     "));
   24.15  }
   24.16  
   24.17 -#ifdef SPARC
   24.18  static void print_me(intptr_t *new_sp, intptr_t *old_sp, bool *was_oops) {
   24.19  #ifdef _LP64
   24.20    tty->print_cr("--------+------address-----+------before-----------+-------after----------+");
    25.1 --- a/src/share/vm/runtime/synchronizer.cpp	Wed Apr 03 16:43:09 2013 -0700
    25.2 +++ b/src/share/vm/runtime/synchronizer.cpp	Thu Apr 04 10:01:26 2013 -0700
    25.3 @@ -449,8 +449,6 @@
    25.4  // and explicit fences (barriers) to control for architectural reordering performed
    25.5  // by the CPU(s) or platform.
    25.6  
    25.7 -static int  MBFence (int x) { OrderAccess::fence(); return x; }
    25.8 -
    25.9  struct SharedGlobals {
   25.10      // These are highly shared mostly-read variables.
   25.11      // To avoid false-sharing they need to be the sole occupants of a $ line.
   25.12 @@ -1639,11 +1637,6 @@
   25.13  
   25.14  #ifndef PRODUCT
   25.15  
   25.16 -void ObjectSynchronizer::trace_locking(Handle locking_obj, bool is_compiled,
   25.17 -                                       bool is_method, bool is_locking) {
   25.18 -  // Don't know what to do here
   25.19 -}
   25.20 -
   25.21  // Verify all monitors in the monitor cache, the verification is weak.
   25.22  void ObjectSynchronizer::verify() {
   25.23    ObjectMonitor* block = gBlockList;
    26.1 --- a/src/share/vm/runtime/synchronizer.hpp	Wed Apr 03 16:43:09 2013 -0700
    26.2 +++ b/src/share/vm/runtime/synchronizer.hpp	Thu Apr 04 10:01:26 2013 -0700
    26.3 @@ -121,7 +121,6 @@
    26.4    static void oops_do(OopClosure* f);
    26.5  
    26.6    // debugging
    26.7 -  static void trace_locking(Handle obj, bool is_compiled, bool is_method, bool is_locking) PRODUCT_RETURN;
    26.8    static void verify() PRODUCT_RETURN;
    26.9    static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
   26.10  
    27.1 --- a/src/share/vm/utilities/debug.cpp	Wed Apr 03 16:43:09 2013 -0700
    27.2 +++ b/src/share/vm/utilities/debug.cpp	Thu Apr 04 10:01:26 2013 -0700
    27.3 @@ -608,18 +608,6 @@
    27.4    return  CodeCache::find_nmethod((address)addr);
    27.5  }
    27.6  
    27.7 -static address same_page(address x, address y) {
    27.8 -  intptr_t page_bits = -os::vm_page_size();
    27.9 -  if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits)) {
   27.10 -    return x;
   27.11 -  } else if (x > y) {
   27.12 -    return (address)(intptr_t(y) | ~page_bits) + 1;
   27.13 -  } else {
   27.14 -    return (address)(intptr_t(y) & page_bits);
   27.15 -  }
   27.16 -}
   27.17 -
   27.18 -
   27.19  // Another interface that isn't ambiguous in dbx.
   27.20  // Can we someday rename the other find to hsfind?
   27.21  extern "C" void hsfind(intptr_t x) {
    28.1 --- a/src/share/vm/utilities/globalDefinitions.cpp	Wed Apr 03 16:43:09 2013 -0700
    28.2 +++ b/src/share/vm/utilities/globalDefinitions.cpp	Thu Apr 04 10:01:26 2013 -0700
    28.3 @@ -355,3 +355,33 @@
    28.4  
    28.5      return size_t(result);
    28.6  }
    28.7 +
    28.8 +#ifndef PRODUCT
    28.9 +
   28.10 +void GlobalDefinitions::test_globals() {
   28.11 +  intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 };
   28.12 +  const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]);
   28.13 +
   28.14 +  for (int i = 0; i < num_page_sizes; i++) {
   28.15 +    intptr_t page_size = page_sizes[i];
   28.16 +
   28.17 +    address a_page = (address)(10*page_size);
   28.18 +
   28.19 +    // Check that address within page is returned as is
   28.20 +    assert(clamp_address_in_page(a_page, a_page, page_size) == a_page, "incorrect");
   28.21 +    assert(clamp_address_in_page(a_page + 128, a_page, page_size) == a_page + 128, "incorrect");
   28.22 +    assert(clamp_address_in_page(a_page + page_size - 1, a_page, page_size) == a_page + page_size - 1, "incorrect");
   28.23 +
   28.24 +    // Check that address above page returns start of next page
   28.25 +    assert(clamp_address_in_page(a_page + page_size, a_page, page_size) == a_page + page_size, "incorrect");
   28.26 +    assert(clamp_address_in_page(a_page + page_size + 1, a_page, page_size) == a_page + page_size, "incorrect");
   28.27 +    assert(clamp_address_in_page(a_page + page_size*5 + 1, a_page, page_size) == a_page + page_size, "incorrect");
   28.28 +
   28.29 +    // Check that address below page returns start of page
   28.30 +    assert(clamp_address_in_page(a_page - 1, a_page, page_size) == a_page, "incorrect");
   28.31 +    assert(clamp_address_in_page(a_page - 2*page_size - 1, a_page, page_size) == a_page, "incorrect");
   28.32 +    assert(clamp_address_in_page(a_page - 5*page_size - 1, a_page, page_size) == a_page, "incorrect");
   28.33 +  }
   28.34 +}
   28.35 +
   28.36 +#endif // PRODUCT
    29.1 --- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Apr 03 16:43:09 2013 -0700
    29.2 +++ b/src/share/vm/utilities/globalDefinitions.hpp	Thu Apr 04 10:01:26 2013 -0700
    29.3 @@ -419,6 +419,24 @@
    29.4    return align_size_up(offset, HeapWordsPerLong);
    29.5  }
    29.6  
    29.7 +// Clamp an address to be within a specific page
    29.8 +// 1. If addr is on the page it is returned as is
    29.9 +// 2. If addr is above the page_address the start of the *next* page will be returned
   29.10 +// 3. Otherwise, if addr is below the page_address the start of the page will be returned
   29.11 +inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
   29.12 +  if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) {
   29.13 +    // address is in the specified page, just return it as is
   29.14 +    return addr;
   29.15 +  } else if (addr > page_address) {
   29.16 +    // address is above specified page, return start of next page
   29.17 +    return (address)align_size_down(intptr_t(page_address), page_size) + page_size;
   29.18 +  } else {
   29.19 +    // address is below specified page, return start of page
   29.20 +    return (address)align_size_down(intptr_t(page_address), page_size);
   29.21 +  }
   29.22 +}
   29.23 +
   29.24 +
   29.25  // The expected size in bytes of a cache line, used to pad data structures.
   29.26  #define DEFAULT_CACHE_LINE_SIZE 64
   29.27  
   29.28 @@ -1296,4 +1314,15 @@
   29.29    return *(void**)addr;
   29.30  }
   29.31  
   29.32 +
   29.33 +#ifndef PRODUCT
   29.34 +
   29.35 +// For unit testing only
   29.36 +class GlobalDefinitions {
   29.37 +public:
   29.38 +  static void test_globals();
   29.39 +};
   29.40 +
   29.41 +#endif // PRODUCT
   29.42 +
   29.43  #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP

mercurial